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
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.