Why use * // <! [CDATA [* and * //]]> * in jQuery script?
I have this part of javascript:
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
jQuery("#page_template option[value='sidebar-page.php']").remove();
});
//]]>
</script>
What do //<![CDATA[u mean //]]>? I have never used it, but lately I meet him very often. Thank you guys for increasing my knowledge !;)
+3
1 answer
CDATA is used to allow a document to be loaded as direct XML. You can embed JS in XML documents without replacing special XML characters such as <,>, &, etc. Through XML entities & lt ;, &, & etc, to prevent corruption of the XML syntax.
, double slash // XML , , CDATA XML.
wiki , : -
XML CDATA , , . CDATA - ; , CDATA , , < < & .
+4