Opened 11 years ago
Closed 11 years ago
#9998 closed bug (worksforme)
.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>
Change History (1)
comment:1 Changed 11 years ago by
Component: | unfiled → attributes |
---|---|
Priority: | undecided → low |
Resolution: | → worksforme |
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
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.