tbaseflug
asked on
Swap Input Values
I have a form with 8 text/inputs - what I wanted to try and do - ideally - is to "grab" the value from one input and "drop" them onto another input - so, the two input values would swap places - is that possible - if so how? I assume jQuery?
Unless the calues are numbers, then you don't need a temp var
//
var a = document.getElementById('input1'), // Assume value = 7
b = document.getElementById('input2'); // Assume value = 4
a.value = a.value + b.value; // a = 11
b.value = a.value - b.value; // b = 7 (was 4)
a.value = a.value - b.value; // a = 4 (was 7)
//
And by "calues", I, of course, meant "values".
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window