jeudi 17 mars 2016

Get value from textbox based on checkbox on change event

I have two textboxes and one checkbox in a form. I need to create a function javascript function for copy the first txtbox value to second textbox on checkbox change event.

I use the following code but its shows null on first time checkbox true.

function ShiptoBill()
{
  var billing = document.getElementById("txtbilling").value;
  var shipping = document.getElementById("txtshipping").value;
  var check = // here i got checkbox checked or not
  if(check == true)
  {
    // here I need to add the txtbilling value to txtshipping
  }

}




Aucun commentaire:

Enregistrer un commentaire