You must Sign In to post a response.
  • Category: JavaScript

    Copy the value of one input box to another input box only if checkbox is checked

    Hi Guys,

    I am using Angular2 with typescript in my application. When i check the checkbox, Copy the value of one input box to another input box. I am beginner to the angular2. Please provide your support on this.

    Thanks in advance!!!
    Simiyon A
  • #768789
    You need register an input even handler with the source textfield to copy the value of one input box to another input box

    indow.onload = function() {
    var src = document.getElementById("one"),
    dst = document.getElementById("two");
    src.addEventListener('input', function() {
    dst.value = src.value;
    });
    };

    $(function () {
    var $src = $('#three'),
    $dst = $('#four');
    $src.on('input', function () {
    $dst.val($src.val());
    });
    });


    Reference: http://stackoverflow.com/questions/22646465/how-to-copy-value-from-one-input-field-to-another


  • Sign In to post your comments