Error: SYNTAX_ERR: DOM Exception 12

Charles picture Charles · Dec 19, 2012 · Viewed 9.2k times · Source

I got the error 'Error: SYNTAX_ERR: DOM Exception 12' with this code:

var html = '<table><tr><td></td><td><input type="text" name="textArea" value="some text" /></td></tr></table>';
$(this.propertyContainer).html(html)

But NOT with this code:

$(this.propertyContainer).html('<table><tr><td></td><td><input type="text" name="textArea" value="some text" /></td></tr></table>')

Here is the html of propertyContainer:

<div xmlns="http://www.w3.org/1999/xhtml" class="property-grid" style="position: absolute; top: 35px; left: 0px;" id="ext-gen126"></div>

Do you have any idea?

Answer

Charles picture Charles · Dec 19, 2012

I found it. I forgot the character '/' at the end of the input tag...

I guess it's because of the dtd:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"
>

Sorry for that...