2

I am using jquery-ui to implement tabs.

However, I need to use it more than one on the same page.

but jquery uses the id "tabs" (as opposed to class or something), so it only works for the first instance.

5 Answers 5

3

Could you change the tabs prefix?

$( ".selector" ).tabs({ idPrefix: 'ui-tabs-primary' });

Other than that, it seemed to work for me out of the box.

Sign up to request clarification or add additional context in comments.

1 Comment

I was missing a line of code, and your code helped me see my mistake.
2

Another way is:

  $(document).ready(function() {
    $("#tabs1").tabs();
    $("#tabs2").tabs();

  });

Comments

1

maybe not the best way, but I worked for two tabs

first tab

   $(function(){
     var options = {
 event:'mouseover',
 selected:0
     };
     $("#tabs").tabs(options);
   });

<div id="tabs">.....</div>

second tabs

$(function(){
     var options = {
 event:'mouseover',
 selected:0
     };
     $(".tabs").tabs(options);
   });
<div class="tabs">.....</div>

Comments

0
$(document).ready(function()
    $("#tabs1, #tabs2").tabs();
});

Comments

0
$(document).ready(function()
    $("#tabs1, #tabs2").tabs();
});

It works perfect! You can add the tabs you want.

$( "#tabs, #tabs1, #tabs2" ).tabs();

Thank you very much user3152277!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.