2016-05-12 8 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="#!"は、通常使用される<button>タグの代わりに<a>タグを押したときにdata-target属性を使用するjavascript関数を呼び出すためのハックとして使用されます。

+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">に置き換えてください。

関連する問題