I am trying to create a drop-down menu where all the options in the drop menu are check boxes. The motivation here is so that the user can easily select multiple options in the drop-down. Based on what they select I need to parametrize the form and make an Aj开发者_JAVA技巧ax request.
You could try one of these two -
http://www.sexyselect.net
or
http://code.google.com/p/jquery-asmselect/
A quick google for jQuery Multiselect returned a jQuery UI plugin as the first result.
Try Dropdown Checklist: http://dropdown-check-list.googlecode.com/svn/trunk/doc/dropdownchecklist.html
<label>
elements make it incredibly simple to make menus like this.
<ul>
<li>
<label for="item-1">
<input type="checkbox" name="item" value="1" />
<span>Item 1</span>
</label>
</li>
<li>
<label for="item-2">
<input type="checkbox" name="item" value="2" />
<span>Item 2</span>
</label>
</li>
<li>
<label for="item-3">
<input type="checkbox" name="item" value="3" />
<span>Item 3</span>
</label>
</li>
...
</ul>
The .live() function is very useful for sending $_POST requests to the server.
Note that adding padding to your <li>
elements or margin to your <label>
will make this method less effective.
精彩评论