I have for eg #test
on many page and in some page the #test
div is not so I wanted to hide .myclass
in which #test
div is not. So I tried the following:
var $bs = $('body').find('#test');
if($bs === 'undefined'){ // but this seems wrong also tried type of $bs === 'undefined'
$('.myclass').css('display','none');
}