I have the following HTML code:
<ul class="message" id="stats-results"> <li>DS1 Records: <span id="ds1Count"></span></li> <li>DEV Records: <span id="devCount"></span></li> </ul>
Is there an easy way to completely remove li elements from ul using jQuery?
li
ul
There is a method just for that, empty ()
$('#stats-results').empty();
Description: Remove all child nodes of the set of matched elements from the DOM.
No need for "tricks."
$("#stats-results").html("");
This will remove all li elements
Try $('ul.message li').remove();
$('ul.message li').remove();
Source: https://habr.com/ru/post/1445179/More articles:OpenGL Matrices VS DirectX Matrices - mathhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1445175/how-to-adapt-directx-style-worldviewprojection-matrices-to-opengl&usg=ALkJrhg_ynr_XtBOln2heDhajB7VnDOWcQHow to get multi-threaded topology using xbee zb? - topologyQuery regarding data entry form - pythonAJAX sends data to Node.js server - javascriptProblem in sqlite with "like" in android - androidCounting by pulling data from multiple tables using multiple keys using sqlite3 - pythonHow to add odd sub-lists in Python? - pythonHow to set the z-index of points on a HighCharts scatter chart? - javascriptTouchesEnded and TouchesCancelled not called - iosAll Articles