I have container, that i got using $(this).parent()
. And i want to check if this container contains element with tag form
. Is there any way to do this with jquery?
I have container, that i got using $(this).parent()
. And i want to check if this container contains element with tag form
. Is there any way to do this with jquery?
- Please post a plete code example. – j08691 Commented Feb 26, 2013 at 14:27
-
use:
$(this).parent().find('form').length
– Boynux Commented Feb 26, 2013 at 14:27
3 Answers
Reset to default 7var container = $(this).parent();
var hasForm = container.find('form').length > 0;
Try this
if ($(this).parent().find('form').length)
alert('its here')
You can use has function
if($this.parent().has('form').length > 0);