问题
Hi
I have 3 textarea elements say tb1,tb2 and tb3. The text values of tb2 and tb3 should get populated in tb1 as soon as i start typing in tb2 or tb3.The format in which text should appear in tb1 is . The space between is important.
Can anyone suggest me javascript for this purpose ?
Thanking in Advance
Girish
回答1:
$($$('#tb2, #tb3')).keyup(function(){
var value = $('#tb2').val() + ' ' + $('#tb3').val();
value = jQuery.trim(value);
$('#tb1').val(value);
});
来源:https://stackoverflow.com/questions/5611158/how-to-add-and-combine-text-value-of-2-textarea-elements-and-populate-the-combin