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>

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.