How to change the buttons text using javascript

后端 未结 5 1303
孤街浪徒
孤街浪徒 2021-01-30 10:10

I have the following code to set the text of the button through javascript code , but it does not work it remains same the text remains same.

function showFilter         


        
5条回答
  •  攒了一身酷
    2021-01-30 10:34

    innerText is the current correct answer for this. The other answers are outdated and incorrect.

    document.getElementById('ShowButton').innerText = 'Show filter';
    

    innerHTML also works, and can be used to insert HTML.

提交回复
热议问题