Bug Tracker

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:


<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");');



</head> <body>

<input id='txt' type='text' value='vide'/>

</body> </html>

With this code they are no event with ie7.

Attachments (1)

bug.zip (14.1 KB) - added by phoenixenator 15 years ago.
source code of bug

Download all attachments as: .zip

Change History (5)

Changed 15 years ago by phoenixenator

Attachment: bug.zip added

source code of bug

comment:1 Changed 15 years ago by gudoy

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 davidserduke

Resolution: wontfix
Status: newclosed

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 sircastor

Resolution: wontfix
Status: closedreopened

$.attr() ought to add whatever attribute requested, regardless of purpose.

comment:4 Changed 15 years ago by flesler

Resolution: wontfix
Status: reopenedclosed

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.

Note: See TracTickets for help on using tickets.