Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Location
    Scotland
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help!? JavaScript does not allow element div

    I am using a jQuery slider for a website but the W3C comes up with invalid because:

    document type does not allow element "div" here
    .before('<div id="buttons">')

    Code:
    <script type="text/javascript">
    $(document).ready(function() {
    $('#slider')
    .before('<div id="buttons"></div>')
    .cycle({
    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    pager:  '#buttons'
    });
    });
    </script>
    Any help with this would be appreciated thanks.

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    Didn't I already reply to this one?

    There is nothing illegal about this javascript string. It is a mistake of the W3C validator to complain about this.

  • Users who have thanked devnull69 for this post:

    Sl33k (08-22-2011)

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Location
    Scotland
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks devnull69,

    It doesn't seem to like the <div> tag being inside the javascript, it might be because it is strict instead of transitional.

    Sorry if I posted twice I don't know what happened to my other post couldn't see it anywhere.

  • #4
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    No, it doesn't have anything to do with strict or transitional. You should either keep the Javascript part out of the validation or ignore the results for the Javascript part.


  •  

    Tags for this Thread

    Posting Permissions

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