Ajax auto-populate from field when another form field is filled out
Has anyone used javascript/ajax to take data from one form field and put it开发者_开发技巧 into another? I'm trying to create a form that when one text input is filled out a second is auto-populated with the first letter of the word that is in the first text input. I'm thinking I can limit the second text input to one character to help get the desired result, but I'm not having luck finding the javascript to get the second text input to auto-populate from the first. Any suggestions?
This seems like it would be pretty easy to do in jQuery.
$('#textBox1').keyup(function()
{
if($.trim($('#textBox2').val()) == '')
$('#textBox2').val($(this).val().substring(0, 1);
});
精彩评论