简体   繁体   中英

Is there an opposite of remove function on JS?

I know that on JS exists a remove() function:

HTMLElement.remove();

I'm just interested to know, if there is a function that does the opposite of remove().

Recently I learned add() function in one of the online tutorials. This worked totally OK on my codes.
Example:

 const closeModal = function() {
    modal.classList.add('hidden');
}

const openModal = function() {
    modal.classList.remove('hidden');
}

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