开发者

display a checkbox after selecting on a drop down menu

开发者 https://www.devze.com 2023-01-26 23:37 出处:网络
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

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:

  1. Add the checkboxes dynamically when an onclick event occurs.
  2. Or hardcode the checkboxes next to each animal then hide them. Then use the onclick event to reveal them.
  3. Lastly use jquery, it's easier
0

精彩评论

暂无评论...
验证码 换一张
取 消