开发者

How do I concatenate two textboxes in JQuery?

开发者 https://www.devze.com 2022-12-22 03:55 出处:网络
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.

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 luc开发者_JS百科k on either phone or address. Any ideas?


The code

$('#txtPropHPhone' + "<br/>" + '#txtPropWPhone')

is basically telling jQuery to look for an element named '#txtPropHPhone<br/>#txtPropWPhone'.

You'll need to break out the individual elements into separate jQuery requests.

$('#txtPropHPhone').val() + '<br/>' + $(txtPropWPhone').val();


Does it work if you get the val()s seperately?

$tr.find('.phone').text($('#txtPropHPhone').val() + "<br/>" + $('#txtPropWPhone').val());
0

精彩评论

暂无评论...
验证码 换一张
取 消