javascript - How to enable the tab while selecting the checkbox -


i have got task jquery tab. on when select check box corresponding tab must show on page , others must disabled.multiple checkbox allowed.then corresponding pages must enabled.

my code is

<html !doctype> <head> <title>jquerymenu</title>     <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />     <script src="http://code.jquery.com/jquery-1.9.1.js"></script>     <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>  <script type="text/javascript"> $(function() {   $("#tabs").tabs();   $("#tabs").tabs("option", {     "selected": 2,     "disabled": [1,2,3]   }); $( "input[type=checkbox]" ).click(function(){      $('#tabs').tabs("enable", $(this).val());      $('#tabs').tabs("select", $(this).val() ); }); });  </script>  </head>  <body>  <div id="tabs">   <ul>     <li><a href="#tabs-1">nithin</a> </li>     <li><a href="#tabs-2">vipin</a></li>     <li><a href="#tabs-3">sachin</a></li>     <li><a href="#tabs-4">ganguly</a></li>   </ul>   <div id="tabs-1">     <p>nithin</p>   </div>   <div id="tabs-2">     <p>vipin</p>   </div>    <div id="tabs-3">     <p>sachin</p>   </div>    <div id="tabs-4">     <p>ganguly</p>   </div> </div> <input type="checkbox" name="tabs-1" value="1">tabs-1  <input type="checkbox" name="tabs-2" value="2">tabs-2  <input type="checkbox" name="tabs-3" value="3">tabs-3  <input type="checkbox" name="tabs-4" value="4">tabs-4  <br>  </body>  </html>  

how can this? can see demo http://jsfiddle.net/2aq2g/4/

you need add condition below

if ($(this).is(':checked'))  

please see fiddle here


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -