Bug Tracker

Opened 15 years ago

Closed 15 years ago

#2558 closed bug (fixed)

$(...).attr returns different values in IE7 and Firefox

Reported by: oridan Owned by:
Priority: major Milestone: 1.2.4
Component: core Version: 1.2.3
Keywords: Cc:
Blocked by: Blocking:




returns the text contained within the onclick attribute.


returns a reference to an anonymous function.


return text contained within the attribute, as per firefox.

Change History (4)

comment:1 Changed 15 years ago by oridan

possibly related to #2511

comment:2 Changed 15 years ago by MelTraX

This 'error' also occurs for IE6.. I'm using a quick fix now which might help you to integrate a proper fix into jQuery:


'onclickValue': function() {

var onclick = this.attr('onclick'); if($.isFunction(onclick))

return (onclick+).substr(23,(onclick+).length-25);


return onclick;



comment:3 Changed 15 years ago by MelTraX

Hmm.. The italic part should have two (onclick+{emptystring}) and a linebreak was lost but I guess you get the picture ;)

comment:4 Changed 15 years ago by flesler

Resolution: fixed
Status: newclosed

This could be patched on .attr(), but would change the behavior for anything else. To get the text on firefox, just use: this[0].getAttribute('onclick');

Note: See TracTickets for help on using tickets.