如何在JQuery中连接两个文本框? [英] How do I concatenate two textboxes in JQuery?
本文介绍了如何在JQuery中连接两个文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在向表中添加行,该地址将是Street,City,State和Zip的串联.现在我有这个.
I am adding rows to my table and the address will be a concatenation of Street, City, State, and Zip. Right now I have this.
$tr.find('.name').text($('#txtPropName').val());
$tr.find('.address').text($('#txtPropAddress', ", ", '#txtPropCity', " ", '#txtPropState', " ", '#txtPropZip').val());
$tr.find('.phone').text($('#txtPropHPhone' + "<br/>" + '#txtPropWPhone').val());
电话或地址都没有运气.有什么想法吗?
No luck on either phone or address. Any ideas?
推荐答案
代码
$('#txtPropHPhone' + "<br/>" + '#txtPropWPhone')
基本上是告诉jQuery查找名为'#txtPropHPhone<br/>#txtPropWPhone'
的元素.
is basically telling jQuery to look for an element named '#txtPropHPhone<br/>#txtPropWPhone'
.
您需要将各个元素分解为单独的jQuery请求.
You'll need to break out the individual elements into separate jQuery requests.
$('#txtPropHPhone').val() + '<br/>' + $(txtPropWPhone').val();
这篇关于如何在JQuery中连接两个文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文