A div contains a table with 3 rows, a textarea and a button. Using JSON the 3 rows display the correct info but the textarea is showing blank. I want it to display the previous record in the DB.
function ChangeLoadingImage(CommentSuccessfullyUpdated) {
if (CommentSuccessfullyUpdated != "FALSE") {
var x = jQuery.parseJSON(CommentSuccessfullyUpdated);
$("#Item").text(x.Item);
$("#Description").text(x.Description);
$("#Price").text(x.Price);
$("#ExistingComments").text(x.ExistingComments);
}
else if (CommentSuccessfullyUpdated == "False") {
showLoadingImage.src = "../Images/X.png";
}
}
<div id="dialog" title="Comments" style="display:none;">
<table class="detailstable FadeOutOnEdit">
<tr>
<th>Item</th>
<th>Description</th>
<th>Owed</th>
</tr>
<tr>
<td id="Item"></td>
<td id="Description"></td>
<td id="Price"></td>
</tr>
</table>
<br />
<textarea id="ExistingComments" type="text" runat="server" rows="7"
maxlength="2000"> </textarea>
<input id="SubmitComment" type="button" value="Submit"
onclick="SubmitButton()" />
</div>
All the correct values are returning in the string. But instead of naming the td, iv named the textarea, but it isn't showing up. Any ideas as to why?
String result = "{" + string.Format("\"Item\": \"{0}\", \"Description\": \"{1}\", \"Price\": \"{2}\", \"ExistingComments\": \"{3}\"", Item, Description, Price, ExistingComments) + "}";
return result;
EDIT: I have also tried alert(x.ExistingComments);
which does display the correct text. Also tried $("textarea#ExistingComments").text(x.ExistingComments);
which does nothing??
$('textarea').filter('[id*=ExistingComments]').val(x.ExistingComments);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.