I am not a Javascript expert but as far as I know:
stopPropagation
is used to make sure the event doesn't bubble up the chain. eg. a click on a <td>
tag would also fire click events on it's parent <tr>
, and then its parent <table>
, etc. stopPropagation
prevents this from happening.
preventDefault
is used to stop the normal action of an element, eg. preventDefault
in a click handler on a link would stop the link being followed, or on a submit button would stop the form being submitted.