Skip to content

24 ways to impress your friends

Vote up?

Ben Bodien


Take the required attribute for example, how do you use that for validation, is it only useful for javascript validation that can check the attribute exists or is there a way in which it works with server-side validation too?

Neither – the attribute is there to tell the browser to take care of the validation itself. No javascript needs to be involved, this is part of HTML5. I believe Opera has support for this already, and others won’t be far behind. You can bolt on some JavaScript checking until there’s broader support, looking for that required attribute and applying functionality accordingly.