"Attribute name not allowed on element div at this point"

There is no name attribute for div elements.

If you want to uniquely identify one, then use id.

If you want to mark one as a member of a group, then use class.

The only place you can use a name attribute (that hasn't been deprecated) is on form controls (input, select, textarea and button).


I found some entry from:

Markup Validation Error: "Attribute name not allowed on element at this point" error #HTML5

Just in case you intend to define a custom attribute, you have to prepend the attribute with "data-".

So in this case, name would be: data-name="".

And you can reference it by 'div[data-name="value"]'.


This is a late response, but since this page just came up in a search:

Since the name attribute is not permitted on certain elements and has special significance in forms which you may not want, but any attribute name starting with "data-" is acceptable to use for purposes of your own, I recommend using the "data-name" attribute, like this:

<div data-name="message" class="jGrowl bottom-right errorGrowl"></div>

You can then write:

$('[data-name="message"]').text("Here is a new message!");

And otherwise manipulate the div via jQuery.

The use of data attributes has the virtue that it is unlikely to conflict with what your frontend designers may be doing with IDs and class names for CSS purposes.

In our office we have an understanding that IDs and classes are reserved for CSS, and JavaScript developers should leave them alone. Conversely, frontend designers are welcome to change the ID, classes or even element type of most things, provided that they don't mess with the data attributes.


The error message seems pretty self explanatory. You cannot have a name attribute on a div tag. So your code could look like this:

<div id="message" class="jGrowl bottom-right errorGrowl"></div>

and then use id selectors:

$('div#message')...