Edit in JSFiddle

function vaihda() {
    var eka = document.getElementById("eka").value
    var toka = document.getElementById("toka").value
    
    document.getElementById("eka").value = toka
    document.getElementById("toka").value = eka
}
<input type="text" id="eka"/>
<input type="text" id="toka"/>
<button onclick="vaihda()">Paina tästä</button>