Error: SYNTAX_ERR: DOM Exception 12


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 <strong>NOT</strong> 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?


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...


No error here: <a href="http://jsfiddle.net/PA4Eg/" rel="nofollow">http://jsfiddle.net/PA4Eg/</a>

Possible mistake is one with the context, I guess (the meaning of this).

The source:

var obj = { propertyContainer: document.getElementById('ext-gen126') }, html = '<table><tr><td></td><td><input type="text" name="textArea" value="some text" /></td></tr></table>'; $(obj.propertyContainer).html(html); ​

In the example bellow my source is the same:

var obj = { propertyContainer: document.getElementById('ext-gen126') }, html = '<table><tr><td></td><td><input type="text" name="textArea" value="some text" /></td></tr></table>'; setHtml.call(obj, html); function setHtml(html) { $(this.propertyContainer).html(html); } ​

I use function to set the HTML content of the given div. For this function I use obj as context. It works again. I hope you'll fix your code by comparing it with the one above.


  • How to forcefully download .csv file instead of getting in open on browser in html
  • Using target on div without a href
  • Is it possible to extract table infomation using Apache Tika?
  • How to start server for Selenium grid Java Maven setup
  • Allocating a 2D contiguous array within a function
  • JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8 throws Unexpected call to method or p
  • Feature detection of foreignObject in SVG
  • XSD with multi occurrences unordered
  • Dynamically load css stylesheet and wait for it to load
  • Splash Screen will not display
  • JBoss External Properties Files in Classpath
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • Jetty 9 HashLoginService
  • Database structure design with variable amounts of fields
  • Read a local file using javascript
  • ImageMagick, replace semi-transparent white with opaque white
  • Seeking advice on Jetty HttpClient Hang
  • does jqgrid support a multiple checkbox list for editing
  • Cannot connect to cassandra from Spark
  • Pass value from viewmodel to script in zk
  • Optimizing database types to compact database (SQLite)
  • How do I fake an specific browser client when using Java's Net library?
  • How to get a value (ex: baseURL) in every Karate feature?
  • Cross-Platform Protobuf Serialization
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Do I've to free mysql result after storing it?
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Java static initializers and reflection
  • How to stop GridView from loading again when I press back button?
  • Turn off referential integrity in Derby? is it possible?
  • unknown Exception android
  • JaxB to read class hierarchy
  • Checking variable from a different class in C#
  • Observable and ngFor in Angular 2
  • Unable to use reactive element in my shiny app
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize