Ad Code

Swapping two text box values

I made a jsfiddle for you:
<input id="txt-pickup" type="text"/>
<input id="txt-destination" type="text"/>
<input id="change" type="button" value="Swap"/>

$(document).ready(function (){

    $("#change").on('click',function(){
        var pickup = $('#txt-pickup').val();
        $('#txt-pickup').val($('#txt-destination').val());
        $('#txt-destination').val(pickup);


    });

});

JSFIDDLE

Post a Comment

0 Comments