Bug Tracker

Modify

Ticket #1964 (closed bug: wontfix)

Opened 5 years ago

Last modified 5 years ago

onclick ie7

Reported by: phoenixenator Owned by:
Priority: undecided Milestone: 1.2.2
Component: event Version: 1.2.1
Keywords: onclick ie7 Cc: Phoenixenator
Blocking: Blocked by:

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

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

Change History

Changed 5 years ago by phoenixenator

source code of bug

comment:1 Changed 5 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 5 years ago by davidserduke

  • Status changed from new to closed
  • Resolution set to wontfix
  • Milestone changed from 1.2.1 to 1.2.2

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 5 years ago by sircastor

  • Status changed from closed to reopened
  • Resolution wontfix deleted

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

comment:4 Changed 5 years ago by flesler

  • Status changed from reopened to closed
  • Resolution set to wontfix

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.