How $(this.hash) works in jQuery? I presupposed that this script should work like this - if I click to link with href tickets it will show div with id tickets. But it not works.
this.hash
reads the href
attribute of this
, and gets the part of the URL beginning with #
. So if the anchor looks like:
<a href="someURL#foobar">
this.hash
will be #foobar
. When you then use $(this.hash).show()
, it's equivalent to doing $("#foobar").show()
, so it will show the element with id="foobar"
.