How do I concatenate two textboxes in JQuery?
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());
精彩评论