Aug 27, 2010

f Comment

Solving jQuery UI Tab Widget Issues in MINUTES!

Amazon I am using JQuery UI Tabs widget library but it doesn't put the content in tabs as it's supposed to. Why? I ran into this issue when I was trying to get JQuery UI's tab widget to work. When it works it looks like the following:

jQuery UI Tabs Example

I included the necessary JQuery libraries which are basically jquery.js and jquery-ui.js, both of which can be accessed from Google Doc's code repository. I verified that those files are accessed correctly, but I just did NOT see my content put in the tabs as jQuery UI API claims to do. After some digging I found that the failure can be due to the following causes.

Cause #1
You need to include the necessary CSS. jQuery comes with a default CSS stylesheet for its UI API; so you can either download it or simply reference it at Google Doc as follows:

<link href='' rel='stylesheet' type='text/css'/>
Note if you download it you may have to correct the path of each background image URL used in the stylesheet. Those URLs are relative paths, and since you'll be hosting it from a different server they'll be broken. You'll have to prefix it with You can further theme your tabs in your own CSS definitions. JQuery UI's official API guide has more information at

Cause #2
Do NOT use self closing script tag! This is extremely weird, but in my experiment I realized things fall apart when I use self closing script tag such as follows:

<script src="" />
You should instead use the following:

<script src=""> </script>
Weird right? I have no idea why this is the case. If any of you experienced the same thing feel free to enlighten me!

That should solve your problem and jQuery UI's tab widget should start working! Questions? Let me know!
Please leave a comment here!
One Minute Information - by Michael Wen
ADVERTISING WITH US - Direct your advertising requests to Michael