According to jQuery Events: Stop (Mis)Using Return False (archived link), returning false
performs three tasks when called:
- event.preventDefault();
- event.stopPropagation();
- Stops callback execution and returns immediately when called.
The only action needed to cancel the default behaviour is preventDefault()
. Issuing return false;
can create brittle code. Usually you’d want just this:
$("a").on( 'click', function (e) {
// e == our event data
e.preventDefault();
});
And secondly “this” is a DOM element in javascript and “$(this)” is a jQuery element
that references the DOM element. Read more on the topic at jQuery’s this: demystified.