Reputation: 1206
I have an element with Id of
#accordion-tab-1
which I try to call with
$(`${window.location.hash}`).prop(`hash`)
and I get 'undefined' when I console.log it but when I do only
$(`${window.location.hash}`)
I get element with that Id
Upvotes: 0
Views: 44
Reputation: 43507
If your URL contains #accordion-tab-1
than all you need to do to select is use direct hash:
$(window.location.hash)
Also use normal quotes '
instead of . More: selecting element and than doing
.prop('hash')leads to
undefinedas DOM element does not have property named
hash`
Upvotes: 1