Using jQuery to see if a div has a child with a certain class
You can use the find function:
if($('#popup').find('p.filled-text').length !== 0)
// Do Stuff
There is a hasClass function
if($('#popup p').hasClass('filled-text'))
Use the children funcion of jQuery.
$("#text-field").keydown(function(event) {
if($('#popup').children('p.filled-text').length > 0) {
console.log("Found");
}
});
$.children('').length
will return the count of child elements which match the selector.
Simple Way
if ($('#text-field > p.filled-text').length != 0)