javascript - Passing a value to a HTML input text box and displaying it -


this first question on stackoverflow. apologies if may seem deviate rules.

i have 2 text boxes , submit button. idea is, user types number, such 7, in first input box. second input box display "seven" when submit button clicked on. first text box of id "userinput" while second 1 of id "useroutput".

as preliminary test, have following code segment in javascript doesn't seem work @ all;

function totest() {     if (document.getelementbyid("inputuser").value==7) {         document.getelementbyid("outputuser").value=="seven";     } else {         window.alert("functionality not added");     } } 

how do this?

html

firstbox <input id="first" type="text" name="fname"><br> secondbox <input id="second" type="text" name="lname"><br> <button onclick="givevalue()" type="button">click me!</button> 

javascript

givevalue = function(){    console.log("hello")    var value = document.getelementbyid('first').value;    document.getelementbyid('second').value = value;  } 

js fiddle

https://jsfiddle.net/64w6yjxv/4/


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -