javascript - jQuery multi select widget with a selectable optgroup -


i looking jquery widget looks following: example

it allows have several groups example:

group 1 - sub 1 1 - sub 1 2 - sub 1 3 group 2 - sub 2 1 group 3 - sub 3 1 - sub 3 2 

clicking on group 1 example, select inside, , clicking again deselect. , should able collapse groups better navigation. seen in image (the small arrow on left side)

is there widget out there?

thanks

the jquery:

$(document).ready ( function ()  {     $('.parent').click(function () {         var set = false;         if ($(this).is(':checked'))             set = true;         $(this).parent().find('ul li').each( function () {             var input = $(this).find('input');             input.attr('checked', set);         });          });     $('span').click(function () {         if ($(this).text() == '-')             $(this).html('+');         else             $(this).html('-');         $(this).parent().find('ul li').each( function () {             $(this).slidetoggle();         });     }); }); 

the html:

<ul>    <li>       <span>-</span><input type="checkbox" value="a" class="parent" />       <ul>          <li><input type="checkbox" value="a1" /> a1</li>          <li><input type="checkbox" value="a2" /> a2</li>       </ul>    </li>    <li>       <span>-</span><input type="checkbox" value="b" class="parent" /> b       <ul>          <li><input type="checkbox" value="b1" /> b1</li>          <li><input type="checkbox" value="b2" /> b2</li>       </ul>    </li> </ul> 

cheers

edit: added collapse.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -