Is there a selector in jQuery that will allow me to select all anchor tags that have a href
beginning with href="/products/index?page="
?
My full href is href="/products/index?page=2"
, but they all have the beginning in common.
Is there a selector in jQuery that will allow me to select all anchor tags that have a href
beginning with href="/products/index?page="
?
My full href is href="/products/index?page=2"
, but they all have the beginning in common.
You can use the starts-with attribute selector, like this:
$("a[href^='/products/index?page=']")
In case you're curious, there are other attribute selectors available as well.
You want to use the jquery starts with psuedo selector:
$('[href^=/products/index?page=]')