Javascript to detect if a div is contained inside another and when is not anymore

Posted by user3668732 on Stack Overflow See other posts from Stack Overflow or by user3668732
Published on 2014-05-29T09:12:31Z Indexed on 2014/05/29 9:25 UTC
Read the original article Hit count: 125

Filed under:
|

i have a question.

I need to detect using javacript (or JQuery) when a div is contained inside another and when is not contained anymore.

I need something like this:

if(div #result).contains (div #dbResults) then{#explainMsg.hide, #errorMsg.hide;
if(div #result).not contains (div #dbResults) anymore then {#errorMsg.show}.

the "not contains anymore" part is because the div's are added dynamically server side.

Obliviously is not the code, but what i need to obtain.

thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery