Jump to content

[SOLVED] need help in jquery based snippet..which i ll be using with my php script


shadowfiend20

Recommended Posts

hi all wat i m trying here is to hide a div using two radio buttons with help of jqueryjquery..but this does'nt seem to b working..here is the fill code if this works probably i can use it in my php scrip..i m new to jquery so,,,,,,,,,

<html>
<body>
<head>
<script language="javascript">
$(document).ready(function() {
      $('#yes').click(function(){
        $('#tab').show();
      });
      $('#no').click(function(){
        $('#tab').hide();
      });
    });
</script>
    
</head>
<form>
   <input type="radio" value="no" name="rad1" id="no" >hide
   <input type="radio" value="yes" name="rad2" id="yes">show
<div id="tab" style="display: block;">hello
</div>
</form>

</body>
</html>

Link to comment
Share on other sites

Firstly let me just say this is a PHP forum so if you want such non php related questions answered quickly, I would suggest posting on relevant sections.

 

Now to try an answer your question, it appears to me that your radio buttons are working independently that is you can select them both, which is not the purpose of a radio button.

 

What you need to do is give both the radio buttons the same name. This will allow you to select only one of the options.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.