<div id="example"> <div id="test"></div> </div> <div id="another">Blah</div>
I want to set $('#another').hide() but only if #example contains a child element called#test, is this possible? It seems like it would be.
$('#another').hide()
#example
#test
Use length
length
if ($('#example').find('#test').length) { // found! }
2.1m questions
2.1m answers
60 comments
57.0k users