tags:

views:

88

answers:

1

say I have the following json object;

{'fname':'john', 'lname':'Locke'}

and the following text boxes

<input type="text" name="txtFirstName" value="" />
<input type="text" name="txtLastName" value="" />

how do I go ahead and assign these textboxes the values in the json object with jquery?

+6  A: 

Something like this should do the trick:

$("input[@name='txtFirstName']").val(jsonObject.fname);
$("input[@name='txtLastName']").val(jsonObject.lname);
John Fisher
thank you x (x was to make it 10 chars)
Emin