"Object doesn't support this property or method"
It's this line.
pthumb = $("#pthumb").attr("src");
Does anyone know why?
"Object doesn't support this property or method"
It's this line.
pthumb = $("#pthumb").attr("src");
Does anyone know why?
Are you ensuring the DOM is ready?
$(document).ready(function(){
//wrap your code in document-ready check
pthumb = $("#pthumb").attr("src");
});
You have a javascript variable called "pthumb" and a DOM element with the id "pthumb", and IE's JS engine could be trying to use the wrong one.
If you have a function also called "pthumb" then IE could also be trying perform this action on the function object.
The last thing to try is to make sure you are using "var" when declaring "pthumb" in the Javascript. i.e.:
var pthumb = $("#pthumb").attr("src");
you could double check the plain javascript method:
var jthumb= document.getElementById('pthumb').attributes['src'].value;
try{
pthumb = $("#pthumb").attr("src");
}
catch(er){
alert(er.message + '\n'+jthumb)
}
If you don't catch the error, the element is not yet ready.
And always it's good if you are checking for Jquery object is null or not.
http://praveenbattula.blogspot.com/2010/01/how-to-check-jquery-object-is-null.html