Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am using the following HTML Statement to execute a JavaScript Function.

HTML
<input type="submit" value="Submit" class="submit_button" />


While I validated this code with the whole source code, it says



You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

So guys what do you think about the error I'm getting.

Thanks and regards,
Chiranthaka
Posted
Updated 15-Oct-14 22:49pm
v2

1 solution

It looks like your JavaScript or JavaScript framework is adding attributes to your
Submit that your current DOCTYPE does not support.

Find your DOCTYPE and swap it out. It should be the first thing on your page (or your master/layout page if you're nesting) and will likely look like:
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 


Now you have a choice, you can either jump into HTML5 or you can stick with HTML4 in a transitional context. To do HTML4 Transitional change the DOCTYPE tag to:
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 


or you can take the modern approach, which is surprisingly terse:
HTML
<!DOCTYPE html>


My advice would be the latter, since HTML4 is currently really a legacy technology, and you can fairly easily implement backwards compatibility by using libraries such as Modernizr. Honestly with the capabilities that HTML5 brings to the table, you'll find it much more pleasant to work with.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900