Searching...
2016年3月3日 星期四

input radio判別資料

<input name="isExampleTourReal" value="true" type="radio" checked>
<input name="isExampleTourReal" value="false" type="radio" checked>否
<input name="isExampleYear" class="isExampleYear" type="text style="width=40px">
<script>
$('input[name=isExampleTourReal]').bind("click",function() {
   if ($(this).attr("value")=="false") {
      $(".isExampleYear").css({"display":"none"});
   }else {
      $(".isExampleYear").css({"display":"block"});
   }
});
</script>

使用bind將事件和函數绑定到元素,利用判斷式attr()取得input value得值

0 意見:

張貼留言

 
Back to top!