Monday, 15 April 2013

jquery - Anchor element in javascript -



jquery - Anchor element in javascript -

where value go when event handler assigned onclick event of anchor element returns value .for example:

<a href="some.htm" id="maiz"> <script> function test(){return x=5;} document.getelementbyid("maiz").onclick=test; <script>

will element receives value if how can access now?

no code waiting homecoming value event handler except event mechanism. so, there no way can homecoming value , process it.

using return false; within event handler cancels event. example:

<html> <head> <title>cancelling hyperlinks</title> </head> <body> <a href="c:" onclick="return false;">c drive</a> </body> </html>

it equivalent to

event.stoppropagation(); event.preventdefault();

read more here...

update

events uses homecoming value:

onclick of href: homecoming false cancels navigation after code executed onsubmit of form homecoming false cancels submission of form

javascript jquery

No comments:

Post a Comment