I have a text box (id = textBox1
) where the html strings can be entered. Ex : <i> Country </i>
Is there a way to get this value using jQuery and append it to a table.
ex : I can get $('#textBox1').val() = <i>Country</i>
.
However when I append to a table, the html styles have been and applied and it stored Country
in italics. I do not want to strip the html tags. It should appear as is in the table.
var text1= $("#text1").val();
var text2= $("#text2").val();
$("#tablePost > tbody").append("<tr data-key='" + text1+ "' data-value='" + value + "'><td>" + key + "</td><td>" + text2 + "</td></tr>");
Note: This should support adding multiple rows to a table.