Possible Duplicate:
Finding whether the element exists in whole html page
i would like make somethings:
HTML:
<span id="one">one</span>
<span id="two">two</span>
<span id="three">three</span>
JavaScript:
if (isset($("#one"))){
alert('yes');
}
if (isset($("#two"))){
alert('yes');
}
if (isset($("#three"))){
alert('yes');
}
if (!isset($("#four"))){
alert('no');
}
LIVE:
http://jsfiddle.net/8KYxe/
how can I make that?
if (($("#one").length > 0)){
alert('yes');
}
if (($("#two").length > 0)){
alert('yes');
}
if (($("#three").length > 0)){
alert('yes');
}
if (($("#four")).length == 0){
alert('no');
}
This is what you need :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With