2016-05-12 109 views
1

I've come across the following links:<a href="#!"> do?

<a href="#!"> 

<a href="#!" class="mob-trigger" data-target="#mob-commercial"> 

In relation to the href, what does the addition of the exclamation mean?

回答

1

在代码中注明您问过关于您也有data-target="#mob-commercial"的问题。

那么发生了什么? href="#!"被用作hack来调用一个javascript函数,该函数在<a>标签上按下时使用data-target属性,而不是通常使用的<button>标签。

+0

因此技术上不需要感叹号,对吗? – seanied

+0

这是正确的 –

0

Technically, it means "Link to the element with id="!". You can see it working in this demo是什么。

实际上,它可能被用作黑客来获得链接而不实际链接到任何东西,以便JavaScript可以绑定到它。它可能应该替换为<button type="button">