SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jquery validation tags with w3

    I use jqueryvalidation plugin that requires something like: <....minlength="3" require /> in input types even FF recgnizes these tags without jquery validation plugin. but w3 doesn't validate my html with these tags. How to fix it? I use:
    !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"

  2. #2
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,888
    Mentioned
    122 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by nimasdj View Post
    I use jqueryvalidation plugin that requires something like: <....minlength="3" require /> in input types even FF recgnizes these tags without jquery validation plugin. but w3 doesn't validate my html with these tags. How to fix it? I use:
    !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    You can't.

    The validator tells you what is allowed under the (X)HTML specification that you are using. Having validation errors is not the end of the world as long as you know what they are and why they are there. Using jQuery code shouldn't cause any browsers to break, so having it there isn't a problem, it just means that it won't pass the validator test.

    Think of it like writing an article and using an old spell-checker, and using the word 'bestie' (which apparently was added to the Oxford English Dictionary last month). The spell-checker will tell you that word is wrong, but as long as you know that that's the word you meant to use, it's fine.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,836
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    require is an HTML5 attribute - not an XHTML1 attribute.

    You could switch to using XHTML 5 and then the attribute would be valid provided you code it as required="required"

    Of course XHTML5 doesn't have a doctype so you'd need to specifically tell the validator that you are using that version. (HTML5 only has a doctype to distinguish between standards and quirks mode in HTML and since XHTML doesn't have a quirks mode there is no need for the tag at all).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •