When you have an <a> that is made interactive via JS, is it best to do href="javascript:void(0)" or is leaving the href out entirely better?
20
1
4
@pamelafox i prefer href="#"… if JS is taking over, you can cancel the event properly with `preventDefault`.
1
1
1
@getify Hm. I am doing preventDefault(). Still sticking the #. Yeah I thought leaving out the href had some different behavior.
1
@pamelafox @getify I think link pseudo classes like hover and focus won't work if no href.
4
Replying to @stubbornella
@stubbornella @pamelafox @getify That's true for :hover and :active in quirks mode only (in at least some browsers). Not in standards mode.

Jan 6, 2013 · 1:56 AM UTC

1
Replying to @davidbaron
@davidbaron @pamelafox @getify thank you for helping me feel not-crazy. ;) I wish I was better at remembering exact browser versions.