2021年1月19日星期二

How to change input field using javascript onclick?

Is it possible to change input field using javascript onclick?? My code:

<form>   <input type="text" id="demo" value="John">  </form>  <button onclick="myFunction()">Click me!</button>    <script>    function myFunction() {      document.getElementById("demo").value = "Hello World";    }  </script>  

it is successful to change the text, but it is failed to change input field value anyidea how to solve it??? Thank you very muchenter image description here

https://stackoverflow.com/questions/65802024/how-to-change-input-field-using-javascript-onclick January 20, 2021 at 09:51AM

没有评论:

发表评论