![]() JavaScript Code: //querySelector selects the element whose id's value is btnĭocument.querySelector('#btn').innerHTML = 'Hide Result' ĭocument.querySelector('#btn').innerText = 'Hide Result' ĭocument.querySelector('#btn').textContent = 'Hide Result' You can also change button text of HTML Element by using any of given methods below (given methods are. JavaScript Code: document.querySelector('#btn').value = 'Remove' ĭocument.querySelector('#btnSubmit').value = 'Remove' If you have HTML Element like input or input then you can change button text in the following way. It also exemplifies the use of jQuery to change the button text. ![]() It shows how the button text changes on load, click, and mouseover. We aim to learn about JavaScript change button text via example code.
0 Comments
Leave a Reply. |