Reputation: 4539
This I should know but it has eluded me. I have the following HTML generated by AVADA shortcode for tabs:
<a href="#tab34830639">Customer Address</a>
I want to do something like below but I am stuck.
jQuery("a:href='#tab34830639'").click(function(){
Upvotes: 1
Views: 5074
Reputation: 15393
Use attribute selector
like this
jQuery("a[href='#tab34830639']").click(function(){
Note : Attribute equal selector - Selects elements that have the specified attribute with a value exactly equal to a certain value.
Upvotes: 1
Reputation: 6771
$('a[href="#tab34830639"]').click(function() {
Available attributes:
= is exactly equal
!= is not equal
^= it starts with
$= it ends with
*= it contains
~= it contains word
|= it starts with prefix (i.e., |= "prefix" matches "prefix-...")
And here is a working demo
Upvotes: 3
Reputation: 67187
Try to use attribute equals selector
,
jQuery("a[href='#tab34830639']").click(function(){
This "a:href='#tab34830639'"
is an invalid jquery selector.
Upvotes: 3