How to add and combine text value of 2 textarea elements and populate the combined text in a third textarea using JavaScript?

做~自己de王妃 提交于 2019-12-12 02:26:57

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!