Reputation: 21
I have some problems with jQuery in IE10. Some scripts doesn't work in that version of IE. In others browser (also in oldest IE) everything works fine. Code of one og them below.
jQuery.fn.firma_wpis = function(form,wymag){
var dur = 350;
var wymag='1';
if(this.attr('checked')==true){
$("#wpis_firma").show(dur);
}
I also added sample code to see if it works, but unfortunately not
$(document).ready(function() {
alert("Works fine");
});
This is simple hide show event when user click on the checkbox. In IE10 Developers Tools I found this error: SCRIPT438: Object does not support property or method
Upvotes: 2
Views: 10265
Reputation: 21
I solved the problem.The scripts are located in different places and not every php file detects jQuery.Because of that I added a link to the jQuery in a specific file, and it works. I know this is not a perfect solution, but the code is a mess
Upvotes: 0
Reputation: 9848
Try this condition:
this.is(':checked')
I.e.:
jQuery.fn.firma_wpis = function(form,wymag){
var dur = 350;
var wymag='1';
if(this.is(':checked')){
$("#wpis_firma").show(dur);
}
Upvotes: 2
Reputation: 773
Your problem may be this
here: if(this.attr('checked')==true){
.
I think you mean $(this)
.
In context, this
refers to the anonymous function being called, not necessarily an instance of jQuery, and thus the .attr
method may not be available. Wrapping the contextual indicator in a jQuery selector will return an object with the proper methods.
HOWEVER it may be caused by jQuery being improperly loaded, or another factor. It would be helpful if you could create and reference a jsFiddle.
Upvotes: 0