Opened 15 years ago
Closed 15 years ago
#1964 closed bug (wontfix)
onclick ie7
Reported by: | phoenixenator | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.2.2 |
Component: | event | Version: | 1.2.1 |
Keywords: | onclick ie7 | Cc: | Phoenixenator |
Blocked by: | Blocking: |
Description
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>
<title>jQuery bug</title> <script type="text/javascript" src="jquery-1.2.1.pack.js"></script> <script type="text/javascript">
$(document).ready(function() {
$('#txt').attr('onclick', 'alert("hello");');
});
</script>
</head> <body>
<input id='txt' type='text' value='vide'/>
</body> </html>
With this code they are no event with ie7.
Attachments (1)
Change History (5)
Changed 15 years ago by
comment:1 Changed 15 years ago by
I suppose it's also related to the fact that under IE 6 and IE 7, $(element).attr('onclick') returns a Function instead of a String.
comment:2 Changed 15 years ago by
Milestone: | 1.2.1 → 1.2.2 |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
jQuery has its own event handling system so doesn't support the onclick (and other) attributes. Try:
$('#txt').click(function () { alert("hello"); });
Closing this bug on that basis.
comment:3 Changed 15 years ago by
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
$.attr() ought to add whatever attribute requested, regardless of purpose.
comment:4 Changed 15 years ago by
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
IE (6/7) doesn't support this action (setting string handlers). That's why there's no need to add bytes of code to support it.
You can always do this by affecting the original dom elements and using setAttribute. It won't work on IE, but that's your decision.
source code of bug