cancelBubble
Posted: Tue Apr 24, 2007 10:28 pm
Hi there. I have a link on a <div> element which has a function assigned to its onclick event.
I am trying to make it so when i click the link only the link executes and not the onclick event of the <div>
I am trying various things with cancelBubble but i guess its no worth it as the function that applies to the link doesnt execute at all.
my code is that
Any ideas?
I am trying to make it so when i click the link only the link executes and not the onclick event of the <div>
I am trying various things with cancelBubble but i guess its no worth it as the function that applies to the link doesnt execute at all.
my code is that
Code: Select all
<div onclick = "javascript: myfunction1()">
<a href = "javascript: my function2()">Click here for function</a>
<div/>Code: Select all
function myfunction2(){
alert("HALLO");
}
function myfunction1(){
alert("WOW");
}