I have a table that carries out some AJAX actions, an returns an error if one is encountered.
I'm using JS to insert this error (which is a string), but because the string has HTML tags in it, it's being appended at the end of the JS element where I wish it to be inserted, as opposed to in the middle.
var debug_error = '<span class="debug-message hidden">'+table_obj.debug_string+'</span>',
row = $(id+' .row-debug'); // id is definded
row.html(debug_error);
For example, if debug_string was <h3>Error</h3><p>Please define an email address</p>, my results are -
<span class="debug-message hidden"> </span>
<h3>Error</h3>
<p>Please define an email address</p>
Yet if I remove the HTML tags, an use just ErrorPlease define an email address, it works as expected -
<span class="debug-message hidden">ErrorPlease define an email address</span>
Does any body know why this is happening? Thanks.