views:

66

answers:

3

Hey guys I'm tryng to hide radio button while showing label image.

<span id="js" class='info'>
  <label><input type="radio" name="vote" value="0" size="<?php echo $row['id']; ?>" onclick="js(this.value, this.size);" /><img src="something.jpg"/></label>
  <br />No:
  <label><input type="radio" name="vote" value="1" size="<?php echo $row['id']; ?>" onclick="js(this.value, this.size);" /><img src="something.jpg"/></label>
 </span>

I know this requires jquery to be linked with my span's id "js" but don't know the javascript code for it. Any help?

Thanks

+3  A: 

It's quite simple:

$('#js input[type=radio]').hide()
Ikke
Only if he has jQuery on the site
Josh Patton
Well, he is talking about jQuery..
Ikke
Good point... my bad.
Josh Patton
+1  A: 

Just use:

$("#js input[type=radio]").hide();
Sarfraz
A: 

Thanks guys! Following worked for me:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
<script>
       $("label input:radio").wrap('<label></label>').parent().hide();
</script>
froufrou
This should not be an answer, but a comment to the answer. Also, you should accept the correct answer by clicking the green check mark.
Ikke