+ 1

How to swap to text boxes value without taking any variable in java script

20th Jul 2017, 2:17 AM
Amit
Amit - avatar
2 odpowiedzi
+ 5
Another way: https://code.sololearn.com/WfoTsGVNRuyT/?ref=app (a little more verbose, but avoiding intermediate array ;P)
20th Jul 2017, 3:54 AM
visph
visph - avatar
0
If they both have an id set: document.getElementById("id1").value = [document.getElementById("id2").value, document.getElementById("id2").value = document.getElementById("id1").value][0]; Otherwise modify it for how you are get the elements.
20th Jul 2017, 3:00 AM
ChaoticDawg
ChaoticDawg - avatar