1. 程式人生 > >JS:點選切換radio觸發事件

JS:點選切換radio觸發事件

html:

<table id="rblEndTime" border="0">
 <tbody>
  <tr id="endtime_tr">
   <td>
       <input id="rblEndTime_0" type="radio" name="rblEndTime" value="20:00" checked="checked">
       <label for="rblEndTime_0">20:00</label>
   </td>
   <td>
	<input id="rblEndTime_1" type="radio" name="rblEndTime" value="21:00" >
	<label for="rblEndTime_1">21:00</label>
   </td>
  </tr>
 </tbody>
</table>

Js:

$(document).ready(function(){
  $('input:radio').click(function () {
    //Code  點選觸發radio時呼叫的方法
  });
});