radio的change事件
<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>
<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>
时间: 2024-12-26 16:29:27