Skip to main content

Bug Tracker

Side navigation

#14103 closed feature (notabug)

Opened July 04, 2013 12:31PM UTC

Closed July 04, 2013 03:21PM UTC

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

Attachments (0)
Change History (1)

Changed July 04, 2013 03:21PM UTC by dmethvin comment:1

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