How to clear all s’ contents inside a parent ?
jQuery’s empty() function does just that: $(‘#masterdiv’).empty(); clears the master div. $(‘#masterdiv div’).empty(); clears all the child divs, but leaves the master intact.
jQuery’s empty() function does just that: $(‘#masterdiv’).empty(); clears the master div. $(‘#masterdiv div’).empty(); clears all the child divs, but leaves the master intact.
If you’re only targeting modern browsers: Use element.classList.add to add a class: element.classList.add(“my-class”); And element.classList.remove to remove a class: element.classList.remove(“my-class”); If you need to support Internet Explorer 9 or lower: Add a space plus the name of your new class to the className property of the element. First, put an id on the element so … Read more