<div class='item'> <p>Askoll M239 (M231)</p> </div>
How can I clear the contents of the .item file in the 1.html file, that is, delete the <p>Askoll M239 (M231)</p>
file?
In the most general form - something like that. But this is pure js - php and ajax are not used here. Perhaps you had something else in mind?
let item = document.querySelector('.item'); let child = document.querySelector('p'); let button = document.querySelector('button'); button.onclick = function() { item.removeChild(child); }
<div class='item'> <p>Askoll M239 (M231)</p> </div> <br /> <button>очистить по клику</button>
Source: https://ru.stackoverflow.com/questions/970678/
All Articles