Bug: JS link - preventDefault being ignored


AaronX

Recommended Posts

In the last two releases I've had - 5.1.4.3000 and 5.1.4.2100 - JavaScript event.preventDefault appears to be suddenly being ignored.

With jQuery, I've got the following snippet of code and HTML:

$("a.tag-link").click(function(e) {
	e.preventDefault;// this fails
	$('#' + $(this).data('target')).tokenInput('add', {id: $(this).data('id'), name: $(this).data('name')});// this executes fine
});
<a href="#" class="tag-link" data-target="tags" data-id="171" data-name="airport" tabindex="-1">airport</a>

All the data attribute stuff works fine, that JavaScript/jQuery executes correctly and as expected.

It's the preventDefault on the actual link click that is failing: the displayport jumps to the top of the page, as would normally be expected from href="#"

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.