It’s very likely that…

I repeatedly see certain bad practices in HTML that ironically contain clues for implementing them properly in their class names or in the way they’re built. In this evergreen post, I collect them.…if you’re using javas…


This content originally appeared on Manuel Matuzović - Blog and was authored by Manuel Matuzović

I repeatedly see certain bad practices in HTML that ironically contain clues for implementing them properly in their class names or in the way they're built. In this evergreen post, I collect them.

…if you're using javascript:void(0) as the value of the href attribute, the element you're actually looking for is <button>.

<a href="javascript:void(0);">
  Open modal
</a>

More accessible alternative:

<button>
  Open modal
</button>

Explanation

The role of <a> is link and the role of <button> is button. Users have certain expectations when they find an element. A general rule of thumb: Use a link if it takes you somewhere else. Use a button if you submit a form or run JavaScript.

My blog doesn't support comments yet, but you can reply via blog@matuzo.at.


This content originally appeared on Manuel Matuzović - Blog and was authored by Manuel Matuzović


Print Share Comment Cite Upload Translate Updates
APA

Manuel Matuzović | Sciencx (2023-04-17T00:00:00+00:00) It’s very likely that…. Retrieved from https://www.scien.cx/2023/04/17/its-very-likely-that-2/

MLA
" » It’s very likely that…." Manuel Matuzović | Sciencx - Monday April 17, 2023, https://www.scien.cx/2023/04/17/its-very-likely-that-2/
HARVARD
Manuel Matuzović | Sciencx Monday April 17, 2023 » It’s very likely that…., viewed ,<https://www.scien.cx/2023/04/17/its-very-likely-that-2/>
VANCOUVER
Manuel Matuzović | Sciencx - » It’s very likely that…. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/17/its-very-likely-that-2/
CHICAGO
" » It’s very likely that…." Manuel Matuzović | Sciencx - Accessed . https://www.scien.cx/2023/04/17/its-very-likely-that-2/
IEEE
" » It’s very likely that…." Manuel Matuzović | Sciencx [Online]. Available: https://www.scien.cx/2023/04/17/its-very-likely-that-2/. [Accessed: ]
rf:citation
» It’s very likely that… | Manuel Matuzović | Sciencx | https://www.scien.cx/2023/04/17/its-very-likely-that-2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.