Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COI assumed he wanted to stopPropagation and preventDefault, the most efficient way to do this is just return false. Furthermore, I have personally experienced browser compatibility issues with those two functions, but never with using return false. I disagree that using return false is bad practice at all, someone deciding to say its better practice on their blog doesn't cut any mustard with me. If he needed the default action but not the bubbling then the correct answer would have been to use e.stopPropagation. I prefer my more elegant answer.
      singulars
    2. COPointing out these things in the link and providing an alternative is a good call, maybe the OP hasn't met them before. But I think claiming there's a 'best practice' for this which is the long way round is not so helpful.
      singulars
    3. COYou assumed that he wanted that without explicitly saying it, which I think is the disservice. Newbies need to understand *what* their code is doing and *why* they should write it one way or another. If the OP wanted to `return false` while understanding its implications, fine. What's a disservice is saying "just return false to prevent propagation" when that's not all returning false does and could have other negative impacts. I'm saying "This is the code that does what you asked, and here's what return false actually does. Use wisely." Really though, it's not that big of a deal.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload