Validating text fields in javascript

05-Dec-2017 08:23 by 9 Comments

Validating text fields in javascript - truth lies and online dating

Validating your code is simply comparing it to W3C standards.Much as different languages have different rules of grammar, the code you use can have different rules depending on the doctype you use.

validating text fields in javascript-49

Some will probably tell you that valid code will help your pages rank better. Other than show stopping errors (which validation can help you find) search engines really don’t care much about your code.

I’ve included some screenshots at the bottom of this post to show the full code I used to check under each doctype.

You can click any of the 3 images for a larger and readable image.

For example forgetting to close a tag early in your document could end up resulting in dozens, even hundreds of errors.

Fix those one or two errors and watch as many more errors are gone when you revalidate the page.

There are plenty of browser extensions that will test the page you’re viewing in the W3C validators.

HTML Tidy is another option for validating pages, though it may not offer the exact same results as the W3C validator.One of the discussions that arises from time to time in web development circles is that of validating your code. It’s no different than comparing a sentence you write to the rules of grammar for the language you wrote it in.Some will insist your pages need to validate 100% and others will tell you it’s not even worth checking as long as your pages work. In fact the grammar analogy is a good one to keep in mind when you think of validating your code.Let’s face it no one can really list every potential show stopping error where search engines are concerned.The safest thing to do in that case is fix all your errors or as many as realistically possible.If you click the links above it’ll look like they go to the same page, but I assure you they’re different.