This seems like a really easy question, but I can’t seem to find the answer.
Now that toggle() is deprecated for click events, how would I have say a button add DOM elements on the first click, then remove those same DOM elements on the second click?
Also…. how do I remove contents from a div I have inserted content into (using load()) without removing the div itself? Using remove() removes the div.
use
empty()to clear an elements inner htmlAs for the toggle issue, you can toggle a class on the element and test for that class: