...

View Full Version : Help!? JavaScript does not allow element div



Sl33k
08-22-2011, 02:08 PM
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">')


<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.

devnull69
08-22-2011, 02:22 PM
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.

Sl33k
08-22-2011, 02:29 PM
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.

devnull69
08-22-2011, 02:45 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum