E
eggie5
I have this even handler (using prototype.js):
showCommentsLinks.observe('click', function(event)
{ alert('hi') });
It's attaching to a link element:
<a id="showCommentsLink" href="comments/">Show Comments</a>
When ever my event handler is called, which can be implied as
javascript is enabled and working, I want to prevent the the browser
from following the href url.
If i wasn't using unobtrusive javascript, I would go like this:
<a id="showCommentsLink" href="comments/" onclick="alert('hi');return
false;">Show Comments</a>'
and that would prevent the browser from going to /comments after the
JS executes. How can I recreate this functionality with the
unobtrusive event handler above?
showCommentsLinks.observe('click', function(event)
{ alert('hi') });
It's attaching to a link element:
<a id="showCommentsLink" href="comments/">Show Comments</a>
When ever my event handler is called, which can be implied as
javascript is enabled and working, I want to prevent the the browser
from following the href url.
If i wasn't using unobtrusive javascript, I would go like this:
<a id="showCommentsLink" href="comments/" onclick="alert('hi');return
false;">Show Comments</a>'
and that would prevent the browser from going to /comments after the
JS executes. How can I recreate this functionality with the
unobtrusive event handler above?