I've come across the following links:Was bedeutet <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?
I've come across the following links:Was bedeutet <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?
Beachten Sie in dem Code, den Sie gefragt haben, dass Sie auch die data-target="#mob-commercial"
haben.
Was passiert also? Die href="#!"
wird als ein Hack verwendet, um eine JavaScript-Funktion aufzurufen, die das data-target
-Attribut verwendet, wenn auf das <a>
-Tag anstelle des <button>
-Tags gedrückt wird, das normalerweise verwandt wird.
Technically, it means "Link to the element with id="!"
. You can see it working in this demo.
In der Praxis wird es wahrscheinlich als ein Hack verwendet, um einen Link zu haben, ohne tatsächlich mit irgendetwas zu verknüpfen, so dass JavaScript daran gebunden werden kann. Es sollte wahrscheinlich durch eine <button type="button">
ersetzt werden.
Also technisch keine Notwendigkeit für das Ausrufezeichen, ist das richtig? – seanied
Das ist richtig –