<div id="main">
<div>
<div>
<a href="/test/number/1">1asd</a>
<div>
<div>
<a href="/test/number/1/phone/0">1fdf</a>
</div>
</div>
</div>
</div>
<div>
<div>
<a href="/test/number/2">2a2d</a>
</div>
</div>
<div>
<div>
<a href="/test/number/3">33</a>
<div>
<div>
<a href="/test/number/3/phone/0">33df</a>
</div>
</div>
</div>
</div>
</div>
function(num){
$('#main a').each(function(){
})
return false;
}
I would like doing:
if num == 1 then this should return me TRUE, because:
isset <a href="/test/number/1/phone/0">1fdf</a>
this link have number and phone
if num == 2 then this should return me FALSE, because:
isset <a href="/test/number/2">2a2d</a>
this link have number and NOT HAVE phone
if num == 3 then this should return me TRUE, because:
isset <a href="/test/number/3/phone/0">1fdf</a>
this link have number and phone
if num > 3 then this should return me FALSE, because:
not isset link with number/4 etc
Thanks for help!
Here’s a fiddle with the solution: http://jsfiddle.net/h7Wda/7/
You basically check if
number/1/phoneis located in the href of the element:Same for the
number/3/phonecase.Any other value will return false.