How to make an anchor tag refer to nothing?

后端 未结 18 1656
一向
一向 2020-12-12 10:28

I use jQuery, I need to make some anchor tags perform no action.

I usually write it like this:

link

H

18条回答
  •  失恋的感觉
    2020-12-12 10:52

    This answer should be updated to reflect new web standards (HTML5).

    This:

    This represents a placeholder hyperlink
    

    ... is valid HTML5. The tabindex attribute makes it keyboard focusable like normal hyperlinks. You might as well use the span element for this as mentioned previously, but I find using the a element more elegant.

    See: https://w3c.github.io/html-reference/a.html
    and: https://html.spec.whatwg.org/multipage/links.html#attr-hyperlink-href

提交回复
热议问题