I have a div with id kGrowl and inside that div I have another div that has a select element with name = mover. I try to use this selector:
$('#kGrowl:contains([name=mover])').length
But it is currently returning 0. How is my selector wrong?
Thanks.
Edit:
Gabriel’s answer is best but I also realized its the :has attribute that will take a jQuery selector, not contains. So you could do:
$('#kGrowl:has([name=mover])').length
contains is mostly for text content where a valid selector doesn’t work. So if you wanted to do it the way you are showing it would be:
$(‘#kGrowl:contains(“name=mover”)’).length but really you want the number of select elements named mover you would use:
cheers.