tags:

views:

99

answers:

2

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?

A: 

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

$tr.find('.phone').text($('#txtPropHPhone').val() + "<br/>" + $('#txtPropWPhone').val());
easement
@easement - The code is better now, but the "<br/>" and '<br/>' tag is returned as a string... am I missing something?
+3  A: 

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();
Paul Alexander
@Paul Alexander - The code is better now, but the "<br/>" and '<br/>' tag is returned as a string... am I missing something?
Use $tr.find('.phone').html(...) instead of $tr.find('.phone).text(...). text() is encoding its parameter, whereas html() will not.
Lobstrosity
Thanks... I am closer :)