jQuery change () не будет работать с моими переключателями в веб-формах asp.net.
Вот ссылка jsFiddle на код, который я пытаюсь использовать в своем приложении веб-формы.
jsFiddle
Я использую jQuery 1.4.1
Кто-нибудь знает проблему?
<!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></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
radiogroup = $('#radio').children('input:radio');
$(radiogroup).change(function () {
if ($(this).val() == 'on') {
alert($(this).val());
$('.timeLimit').show();
}
if ($(this).val() == 'off') {
alert($(this).val());
$('.timeLimit').hide();
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="radio" class="cell ms-formbody">
<input type="radio" value="on" id="radio1" name="radio" /><label for="radio1">On</label>
<input type="radio" value="off" id="radio2" name="radio" checked="checked" /><label for="radio2">Off</label>
</div>
</form>
</body>
</html>
Я потратил более 3 часов, пытаясьнайти причину моей проблемы, и теперь отчаянно нуждаюсь в помощи.(