Check if element contains another one in jQuery -
I found many related things on stack overflow but are not applicable to my case.
For all this example, I need to see that there is an element in another element, and if yes, then add something.
$ (".bt_repondre"). Click (function () {comment = $ (this) Parent (). Parent (). (); // I want to comment whether the comment should be a .comment_full element, if not, Attach the comment .append ('add');}); Hope you can help me, I tried many things ...
just use the .find () and check whether the element returns, such as: $ (".bt_repondre" ). Click (function () {Comment = $ (this) .Parent () .Parent (); if (! Comment.find ('. Comment_full') length) {comment.append ('add'); }});
Comments
Post a Comment