javascript - How to get button to add text to input form -


forgive me

function addtext() {  var input = document.getelementbyid('something');  input.value = input.value +'urgent please read';  }
<form name="frm1" action="?" onsubmit="addtext()">  <p> subject </p><input type="text" name="subject" size="40" id="something" onsubmit="addtext()"maxlength="30" />                         <p>message</p>  <textarea id="angryarea" name="message" cols="100" rows="20"></textarea>                             <input type="submit" value="make urgent" id="urgent"/>                        </form>

am new js , attempting create button adds words "urgent please read" subject of message; however, following code clears subject head. thank in advance,

i'm not sure if wanted separate button make urgent , submit - if can this

function addtext() {      var input = document.getelementbyid('something');      input.value = input.value + 'urgent please read';  }
<form name="frm1" action="?" onsubmit="addtext()">    <p> subject </p><input type="text" name="subject" size="40" id="something" maxlength="30" />      <p>message</p>    <textarea id="angryarea" name="message" cols="100" rows="10"></textarea>         <button type="button" id="urgent" onclick="addtext()">make urgent</button>    <input type="submit" value="submit" id="submit"/>  </form>


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -