Awad Maharoof
Awad Maharoof

Reputation: 2360

Attribute set using jquery not added to element only in IE 9

Using jQuery, I add 2 attributes to an object element like this

$('#myObject').attr('codebase', pluginURL_IE);
$('#myObject').attr('onerror', 'InstallFailed();');

This code works on IE 7 and IE 8 but not in IE 9.

I inspected my tag using developer tools and found that the 'codebase' attribute is set and the 'onerror' attribute is not getting set in IE 9.

Any idea why I'm facing this problem only in IE 9? Thanks in advance.

Upvotes: 0

Views: 286

Answers (2)

Michael Lu
Michael Lu

Reputation: 83

You could use the .error() event handler in jQuery. The following is an example

$('#myObject').error(function(){
  InstallFailed();
});

Upvotes: 1

Dipak
Dipak

Reputation: 12190

Try -

$('div').attr({codebase: 'pluginURL_IE', onerror: 'InstallFailed();' });

Demo

Upvotes: 0

Related Questions