Side navigation
#9998 closed bug (worksforme)
Opened August 08, 2011 09:16AM UTC
Closed August 08, 2011 09:34AM UTC
.attr('onchange') returns undefined
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | attributes | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When trying to collect onchange using 1.6.1 it returns undefined. Yet when trying to collect onchange using 1.5.1 it returns the correct funtion.
This is the c# rendered code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>Not working</title> <script type="text/javascript" src="includes/jquery-latest.pack.js"></script> <script type="text/javascript"> $(function() { alert( $('#ddlJobRole').attr('onchange') ); }); </script> </head> <body> <select name="ddlJobRole" onchange="javascript:setTimeout('__doPostBack(\\'ddlJobRole\\',\\'\\')', 0)" id="ddlJobRole"> <option selected="selected" value="">Please Select...</option> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> </select> </body> </html>
Attachments (0)
Change History (1)
Changed August 08, 2011 09:34AM UTC by comment:1
component: | unfiled → attributes |
---|---|
priority: | undecided → low |
resolution: | → worksforme |
status: | new → closed |
I've put together a test case on jsFiddle matching the code you've supplied and it's working fine for me across Chrome, Firefox, Opera and IE9. http://jsfiddle.net/8nTps/1/. This is using jQuery 1.6.2 (and not 1.6.2, which is an older release). Please double check that your solution works fine with 1.6.2 or jQuery edge as it works for me.