Yep. That, or put your scripts externally. :)

On Feb 27, 9:17 am, clivey_g <cliveg...@gmail.com> wrote:
> hiya,
>
> i discovered that my lovely xhtml page stopped being xhtml valid when
> i used the jquery append function.  it gives the error:
> "document type does not allow element "link" here"
>
> the solution is to wrap the javascript in a cdata tag like this:
>
>         <script type="text/javascript">
>                 // enclose the jscript in cdata tag so it is still xhtml 
> compliant
>                 //<![CDATA[
>                 $(document).ready(function(){
>                         // load the correct css file
>                         if ($.browser.msie) {
>                                 $("head").append('<link rel="stylesheet" 
> href="css/ls_v3ie.css"
> type="text/css" media="screen" />');
>                         } else {
>                                 $("head").append('<link rel="stylesheet" 
> href="css/ls_v3.css"
> type="text/css" media="screen" />');
>                         }
>                 });
>                 //]]>
>         </script>
>
> i hope this helps anyone who comes across the same issue!

Reply via email to