jQuery tabs

Has anyone done any themes using jQuery ui tabs? Or any online examples with ContentBox? I keep getting a mixture of the blog in the tab content.
I have not placed it online yet. No errors. It is a display problem.

Hi George–

Can you expand a little on what you’re trying to accomplish, or the issue that you’re experiencing?


Hi Joel,

Let me send you a screen grab tonight. I have placed the tabs on a services.cfm page and that page is wrapped in a cfsavecontent. I then include that that in a widget and return the variable from cfsavecontent.


George Murphy

Sounds good, George. Can you also include some snippets of how you’re including jQuery UI tabs and how you’re initializing the tabs? It might simply be an issue of how the library is getting included or how the tabs are getting setup.

Also, I don’t know your specific requirement, but you might check out Bootstrap for this. It has tabbed content support, and is extremely simple to implement (we use it on the admin side for ContentBox in a lot of areas).

Hi Joel,

I sure will show you what I have. Talked with Seth as well and that is what he recommended. Please tell me if this is correct. Load the CSS first then any javascript and jQuery last. Is that correct?


That sounds pretty standard:


See the “Put Stylesheets at the Top” and "Put Scripts at the Bottom" sections of the article.

Just remember, that things like mouse over events need to be bound after page load. Otherwise you can get JavaScripts errors after the HTML has loaded, but the JavaScript hasn’t.



ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Hi Joel,

Following up with the issue with getting tabs to display properly using jQuery UI. Bootstrap will not work for me because it causes problems conflicting with my other CSS.

Attached is a screen shot of what is happening with the jQuery tabs.

I have confirmed that the layout does not matter.

Tried this on the Truly Simple layout.This is what the head looks like.

  <link rel="stylesheet" href="//[code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css](http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css)">

  <script src="//[code.jquery.com/jquery-1.9.1.js](http://code.jquery.com/jquery-1.9.1.js)"></script>

  <script src="//[code.jquery.com/ui/1.10.4/jquery-ui.js](http://code.jquery.com/ui/1.10.4/jquery-ui.js)"></script>

Then added this through the widget as an include
<cfsavecontent variable="webtabs">
<div id="tabs">
<li><a href="#tabs-1">Nunc tincidunt</a></li>

<li><a href="#tabs-2">Proin dolor</a></li>
<li><a href="#tabs-3">Aenean lacinia</a></li>
<div id="tabs-1">
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>

<div id="tabs-2">
<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>

<div id="tabs-3">
<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>

<p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>

$(function() {
$( "#tabs" ).tabs();

Hi George–

Can you show the code for the widget you’re using?

Hi Joel,

Pretty simple widget


  • This widget takes the tabs and enders them in DBG
    component extends=“contentbox.model.ui.BaseWidget”{

function init(controller){
// super init

// Widget Properties
setPluginName( “getdbgservices” );
setPluginVersion( “1.0” );
setPluginDescription( “This widget takes the tabs and renders them in DBG” );
setPluginAuthor( “George Murphy” );
setPluginAuthorURL( “http://websbygeorge.com” );
//setForgeBoxSlug( “” );
setCategory( “Miscellaneous” );
setIcon( “page.png” );

return this;


  • Render the widget out
    any function renderIt(){
    include “/servicespage/services.cfm”;
    return webtabs;


Ah, interesting. I see the issue. Looks like a bug in jQuery UI…or a feature…or both?

See this thread: http://stackoverflow.com/questions/13837304/jquery-ui-non-ajax-tab-loading-whole-website-into-itself

It describes the issue you’re experiencing precisely, including a couple work arounds.

A JavaScript work around that you can drop-in is mentioned in one of the comments:

$("#mytabs UL LI A").each(function() {
    $(this).attr("href", location.href.toString()+$(this).attr("href"));

It’s a little hacky, though, since it requires working around jQuery UI. I tried it, though, and it works.

Alternatively, you could also fix this by using cb.linkSelf() to create the full URLs for the tab hash links: e.g., #cb.linkSelf()###tabs-1

Hope that helps!

Hi Joel,

Thank you for taking the time to point me in the right direction on this. I tried several different options and the only one that worked for me was this.

jQuery(function() {
jQuery( “#tabs” ).tabs();

Hi George–

Sure thing. Re: the solution you’re using, I would advise being careful with removing the base tag–it could have unintended consequences in other areas. Did you try adding the full links to the tab hrefs?

Hi Joel,

Yes I tried using the cb helper code.
The only time the jquery code runs is on the tabs. It did not seem to effect the other menu links. I am going look at ext Js as well.
Looked at Bootstrap but it’s styles interfered with mine.