Manu _Haa
Manu _Haa

Reputation: 3

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().

Upvotes: 0

Views: 4658

Answers (1)

Mirkomilboy Sadirov
Mirkomilboy Sadirov

Reputation: 26

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');
}

Upvotes: 1

Related Questions