My script is failing in calling prop()
. I am getting the message:
JavaScript runtime error: Object doesn't support property or method 'prop'
$(document).ready(function() {
$("input:checkbox").click(function () {
if (!$(this).is(':checked')) {
$(this).prop('checked', true);
return;
}
var checkvalue = $(this).val();
$('input:hidden[id*="_PropositieType"]').val(checkvalue);
$("input:checkbox").not(this).removeAttr("checked");
});
});
I am using IE 11 and jquery 1.5.1. I want it to work with all browsers.
My script is failing in calling prop()
. I am getting the message:
JavaScript runtime error: Object doesn't support property or method 'prop'
$(document).ready(function() {
$("input:checkbox").click(function () {
if (!$(this).is(':checked')) {
$(this).prop('checked', true);
return;
}
var checkvalue = $(this).val();
$('input:hidden[id*="_PropositieType"]').val(checkvalue);
$("input:checkbox").not(this).removeAttr("checked");
});
});
I am using IE 11 and jquery 1.5.1. I want it to work with all browsers.
click
, use change
event
– Tushar
Commented
Dec 2, 2015 at 10:23
.prop
was not in jQuery as of version 1.5
– Niccolò Campolungo
Commented
Dec 2, 2015 at 10:32
jquery 1.5.1
that's said it all
– A. Wolff
Commented
Dec 2, 2015 at 10:32
Use j Query 1.6 or higher version
j Query 1.6+ uses
$('.Checkbox').prop('checked', true);
$('.Checkbox').prop('checked', false);
jQuery 1.5. and below
$('.Checkbox').attr('checked', true);
$('.Checkbox').attr('checked', false);
Try attr
in place of prop
. Because prop
is available in jQuery version 1.6+.
Here you can find the plete info.