I am running the following javascript:
$('img').each(
function(){
var w = parseInt(this.width);
alert(w);
alert(this.src);
if(w > 300){
var percent = parseInt((w/666)*100);
$(this).removeAttr('width height').css('width',percent + "%");
}
});
And I am getting the following error:
Error: uncaught exception: [Exception… “String contains an invalid
character” code: “5” nsresult: “0x80530005
(NS_ERROR_DOM_INVALID_CHARACTER_ERR)” location:
“http://code.jquery.com/jquery-1.6.4.min.js Line: 2”]
I’m having trouble actually trying to track this one down as it isn’t very descriptive of the problem or the source of the problem. Can anyone shed some light on the problem?
Thanks
It looks like you don’t know the proper syntax.
Try this: