Wednesday 12 August 2015

Select Radio button from a tr on click


If you click on tr (any row) also radio button will select 

<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>


<table border="2" cellpadding="5">
      <tr>
      <td>1 </td><td>Java </td><td><input type="radio" id="one" name="numbers">One</input></td>
      </tr>
      <td>2 </td><td>JQuery </td><td><input type="radio" id="two" name="numbers">Two</input></td>
      </tr>
      <td>3 </td><td>Ajax </td><td><input type="radio" id="three" name="numbers">Three</input></td>
      </tr>
</table>
<script>
$(document).ready(function() {

$("tr").bind("click",function () {

$(this).find('td input:radio').prop('checked', true);

});

});
</script>

No comments:

Post a Comment