Reputation: 33
I've come across the following links:
<a href="#!">
<a href="#!" class="mob-trigger" data-target="#mob-commercial">
In relation to the href, what does the addition of the exclamation mean?
Upvotes: 2
Views: 5641
Reputation: 6723
Notice in the code you asked about that you also have the data-target="#mob-commercial"
.
So what is happening? the href="#!"
is used as a hack to call a javascript function that uses the data-target
attribute when pressed on the <a>
tag instead of the <button>
tag which is usually used.
Upvotes: 2
Reputation: 943209
Technically, it means "Link to the element with id="!"
. You can see it working in this demo.
In practise, it is probably being used as a hack to have a link without actually linking to anything, so that JavaScript can be bound to it. It should probably be replaced with a <button type="button">
.
Upvotes: 0