Skip to content Skip to sidebar Skip to footer

Javascript To Copy Text From Select Field To Text Field

I am trying to copy the values from a select field to a text field I came across this http://jsfiddle.net/f23uP/ But when I created a test page using the following it does not work

Solution 1:

Wrap your javascript in $(document).ready():

$(document).ready(function() {
  $('select').change(function(){

    $('input[type=name]').val($('option:selected',this).text());
    $('input[type=price]').val($(this).val());
  });
});

See this post for further explanation.

Post a Comment for "Javascript To Copy Text From Select Field To Text Field"