jQuery radio change事件 checkbox选中事件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>test</title>
<script src="jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
  $(".radioItem").change(function() {
    var $selectedvalue = $("input[name='rl$tt']:checked").val();
    // alert($selectedvalue);
    if ($selectedvalue == 1) {
      alert('1');
    } else {
      alert('2');
    }
  });
});
</script>
</head>
<body>

<input id="rl_1" class="radioItem" checked="checked" name="rl$tt" type="radio" value="1" />
<label>1</label>
<input id="rl_2" class="radioItem" name="rl$tt" type="radio" value="2" />
<label>2</label>

</body>
</html>

<label><input name="zjsj1" id = 'zjsj1' type="checkbox" value="" />最近时间</label>

$("#zjsj1").click(function(){
  if($('#zjsj1').is(':checked')) {
    alert('sdf')
  }
});

原文地址:https://www.cnblogs.com/zhaoyingjie/p/6133020.html