if hyperlink has onclick overridden, then how do I later reset default behavior

J

Jake Barnes

Imagine I've a function called suprise and I've a link called
goSomewhereCool and I do this:

document.getElementById('goSomewhereCool').onclick = surprise;

Now later I want to reset the onClick of the link so it just does what
you'd expect from a link - when you click on it you go the URL that is
in its href property. How do I remove surprise from the onclick and
make the link go back to normal?
 
V

VK

Jake said:
Imagine I've a function called suprise and I've a link called
goSomewhereCool and I do this:

document.getElementById('goSomewhereCool').onclick = surprise;

Now later I want to reset the onClick of the link so it just does what
you'd expect from a link - when you click on it you go the URL that is
in its href property. How do I remove surprise from the onclick and
make the link go back to normal?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top