I want to check if I'm on a specific page and if I'm inside that page and a div exists to do something.
I know how to check if a specific page exists: if('http://'+location.hostname+location.pathname+'/stats')
I know to check if a specific div exists: if($(".div").length) {
but how can I add the second if inside the first if ?
I've tried this but is not working:
if('http://'+location.hostname+location.pathname+'/stats') {
if($(".div").length) { //do something;}
}
Is this possible with jQuery ?