jquery clear html
// removes only text, no changes to children
$('#YourDivId').contents().filter((_, el) => el.nodeType === 3).remove();.remove("#elemnt_id .elemnt_class");<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>empty demo</title>
<style>
p {
background: yellow;
}
</style>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
</head>
<body>
<p>
Hello, <span>Person</span> <em>and person</em>.
</p>
<button>Call empty() on above paragraph</button>
<script>
$( "button" ).click(function() {
$( "p" ).empty();
});
</script>
</body>
</html>
Also in JavaScript:
- try catch with for loop in javascript
- How to Set focus to first text input in a bootstrap modal after shown
- créer composant react
- node.js server
- how to Check if an array contains a string
- jquery version how
- just number regex
- angular countdown timer
- jquery select box change event
- rafraichir page javascript
- onclick timer javascript
- .gitignore nodejs
- declarar una funcion javascript
- jquery cheat sheet
- php generate random string fixed length
- image popup js close button
- javascript number format
- how to send array to js file in wplms
- how to concatenate strings javascript
- d3 v6
- react supported events
- mysql JSON_SEARCH LIKE
- object get property with max value javascript
- jquery add style