Reputation:
<span id="restmap9" class="taLnk hvrIE6" onclick="...">Map</span>1
I want to get the onclick
value from this type on code but only if the id
contains restmap
.
I tried with this code:
if($(v).find('span.taLnk:contains("restmap")').length)2
But it doesn't work.
I can't change this code and can't use the classes as they are used in another part of the website.
$(v)
is my source code.
Upvotes: 0
Views: 49
Reputation: 382150
For this kind of search over a set of elements with a precise non standard condition, you may use filter
:
if ($('.taLnk',v).filter(function(){
return /^restmap\d+$/.test(this.id)
}).length) {
Upvotes: 1
Reputation: 85545
Simply do like this:
if($(v).find('[id~="restmap"].taLnk').length)
Upvotes: 3