Bug Tracker

Opened 7 years ago

Closed 7 years ago

#14103 closed feature (notabug)

Overwriting event handler functions by name

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

Sorry for my english.

My suggest is refering event handler functions to elements event by that function's names. This allow to developer overwrite handler function or delete it. Example:

$('div.button').click(function alert() { alert('I\'m clicked'); }); $('div.button').click(function alert() { alert('I\'m clicked again');

At this time, clicking on this element will showing alert window twice with message "I'm clicked" at first time and "I'm clicked again" at second.

In my case, it show only one alert window with message "I'm clicked again", because second click-event handler initializing has function with same name as first, and this function just overwrite prevoius.

Thats all.

Thank you, and waiting for your request

Change History (1)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

You're defining alert() twice so the last definition wins. You're calling alert() recursively so the stack overflows after that. Ask for programming help on StackOverflow.

http://i.imgur.com/pcaeUaA.png

Note: See TracTickets for help on using tickets.