How can I update the div when clicking on a button via javascript?

<a href="#" id="update">Обновить</a> <div id="content"></div> 

    1 answer 1

    What to update?
    Somehow conditions are not enough.

    So?

     function update(){ document.querySelector('#content').innerHTML = 'Обновлено?'; } document.addEventListener('DOMContentLoaded', function(){ document.querySelector('#update').addEventListener('click', update); }); 

    See an example

    • @KYRAN, Age has nothing to do with it. But please. - user31688