+ 1
Jquery, how to get a number from an input field and plug it into another input field
Im having problems with the following code: function myFunction3() { var x = document.getElementById("myNormal").value; document.getElementById("fuskgrej").innerHTML = x; } Both myNormal and myNumber are input fields, essentially im trying to get the number that is currently inside the myNormal input field and change the number in the myNumber input field by pressing a button. Also heres the input fields: <p style="font-size: 200%" id="height1"> Current height: <input type="number" id="myNumber" value="1"></p> <p style="font-size: 200%" id="height2"> Normal height: <input type="number" id="myNormal" value="1"></p>
3 Respuestas
+ 1
Sebastian Pehrson
using jQuery :-
$('#myNumber').val($('#myNormal').val());
using JavaScript :-
document.getElementById("myNumber").value = document.getElementById("myNormal").value;
+ 1
Thanks! Im still really new to all this coding stuff, this really helped!
- 1
Sebastian Pehrson
No problem. It happens when you learn something new.