简体   繁体   中英

Do something on change of display property of element

I have div which frequently appears and disappears based on users interaction on page. I want to trigger validation when the display property of element changes to display:none . What is the best way to do it?

The DOM is a view . Things like "do something when this happens" is an event-like trigger, this belongs in your model .

Find all places where you set display: none; and replace it by a hookable process.

You may also try, since you are changing property from shown to hidden.

jquery's .hide() , has not only duration as parameter but on complete event also, by which you can do something when .hide() completes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM