I’ve got a working a.click() function in jquery…
But if I click an anchor, I open an new window… But how can I stop the browser from opening a new window itself??
example:
$('a').each(function() {
$(this).click(function(e) {
if($(this).attr('target') == '_popup') {
//here is code to open window (already exists)
//try to stop propagation, but doesn't work...
e.stopPropagation();
}
hideNSL();
});
});
so, how do I stop the event??
Try
but here
return falsemay also do it which is in the other answer.preventDefaultcan be used in more senarios and is a more generic “stop the default event action”, see: http://api.jquery.com/event.preventDefault/