It’s pretty easy for me to get this going and it works:
if ($(this).next().is("object")){//dostuff}
But due to new div containments i now have to check the first child of this.
But $(this) doesn’t play nice with selectors, how do i do the same kind of thing in that situ?
This doesn’t work:
if ($(this:first-child).is("element"))
What do you mean it “doesn’t play nice”? You don’t write
:first-childoutside of a string for any other selector, so why would you withthis?Stack selectors on
$(this)like you would on any other jQuery object:or:
There may be more effective solutions for this specific scenario, but my answer demonstrates how to use
$(this)like any other jQuery object.