About 5,390,000 results
Open links in new tab
  1. How do I clear the content of a div using JavaScript?

    Jul 6, 2018 · When the user clicks a button on my page, the content of a div should be cleared. How would I go about accomplishing this?

  2. How to clear the content of a div using JavaScript?

    Jan 15, 2024 · JavaScript provides the functionality of clearing the content of div. There are two methods to perform this function, one by using the innerHTML property and other by using the …

  3. Clear the Content of a DIV using JavaScript - Online Tutorials …

    Jan 19, 2023 · Users can follow the syntax below to use the firstChild property and removeChild () method to clear all content of the div element. divElement.removeChild(divElement.firstChild); …

  4. javascript - Clear content with button - Stack Overflow

    Mar 12, 2020 · function fn() { var Name = document.getElementById('name').value; var paragraph = document.createElement('p'); paragraph.innerHTML = Name + ' (X)'; paragraph.onclick = …

  5. How to clear a textbox using javascript - Stack Overflow

    Nov 9, 2010 · I need a javascript method to clear the value of the textbox when the focus is on the textbox. How can this be achieved? just get element using. function name() …

  6. HTML how to clear input using javascript? - Stack Overflow

    You could use a placeholder because it does it for you, but for old browsers that don't support placeholder, try this: <script> function clearThis(target) { if (target.value == …

  7. JavaScript console.clear () Method - W3Schools

    Description The clear() method clears the console. The clear() method also write "Console was cleared" in the console.

  8. Clear the Content of a Div element using JavaScript - bobbyhadz

    Mar 5, 2024 · Use the replaceChildren() method to clear the content of a div element, e.g. div.replaceChildren(). When the replaceChildren method is invoked without passing it any …

  9. Set.prototype.clear () - JavaScript | MDN

    Feb 11, 2025 · The clear () method of Set instances removes all elements from this set.

  10. Clear the element - The Modern JavaScript Tutorial

    Create a function clear(elem) that removes everything from the element.

Refresh