display a checkbox after selecting on a drop down menu
I have created a drop down menu with animals. But what I wanna do now is, after I have selected one of the animals from the drop down, can I 'display' a checkbox bu开发者_开发百科tton? Like... hide it initially and then after I have select one of the animals and click on it, the checkbox button will be visible?
I can only do on the code for drop down menu...
<li><a href="#"
onmouseover="mopen('m1')"
onmouseout="mclosetime()">animals</a>
<div id="m1"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a href="#">Dogs</a>
<a href="#">Cats</a>
<a href="#">Cow</a>
<a href="#">Goats</a>
<a href="#">Tiger</a>
</div>
</li>
Help please!
using jquery like :
<a href="#" onclick="$('#chkdogs').show();return false;">Dogs</a>
<input id="chkdogs" type="checkbox" name="dogs" value="dog" style="display:none;">
What I would suggest you do is:
- Add the checkboxes dynamically when an onclick event occurs.
- Or hardcode the checkboxes next to each animal then hide them. Then use the onclick event to reveal them.
- Lastly use jquery, it's easier
精彩评论