Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing an event

Status
Not open for further replies.

Peppi

Programmer
Apr 9, 2001
205
CA
Hi,

I have an onChange event for my dropdown box. What this event does is creates a clone of the existing dropdown box. Now this new dropdown box will have an onChange event. However, I now want to remove the event from the original dropdown so that it can no longer be called.

I've tried
sender.removeAttribute("onchange");

and

sender.detachEvent("onchange", addNewRow);

but neither one works.

Any help is appreciated.
 
OK, that works fine.

So now if I want to do the opposite, that is, dynamically add an event handler instead of remove one, here is what I do in my addNewRow function:

task.onchange = addNewRow(this);

However, this immediately calls addNewRow again. I don't want to run the event handler, just set it. How can I set it without calling it?

Thx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top