2016-05-12 112 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">