Home > Web Front-end > HTML Tutorial > Detailed explanation of the use of

Common expressions of html templates

<script id="template" type="text/template">
<!-- 模板部分 -->

<!-- 模板结束 -->  
</script>
$("#templte").html();
Copy after login

Remarks: The difference between the html() method and text(), html takes the html content (including tags) in the selector, while text( )Get only the text of the document in the selector (not including tags)

<pre name="code" class="html"><script id="template" type="text/x-template">
<!-- 模板部分 -->

<!-- 模板结束 -->  
</script>
Copy after login
<pre name="code" class="html"><script id="template" type="text/html">
<!-- 模板部分 -->

<!-- 模板结束 -->  
</script>
Copy after login

New code method in 2013,html5tag format

#

<template id="template">
<!-- 模板部分 -->

<!-- 模板结束 -->  
</template >
Copy after login

CDATAThis thing is unique to XML. The content in it will not be parsed by the XML parser. You can understand it as Metadata

Preventing events from bubbling and default behavior in jQuery

Prevent bubbling:

event.stopPropagation(); // 阻止事件冒泡
Copy after login

Prevent default behavior:

event.preventDefault();  //阻止默认行为 ( 表单提交 )
Copy after login

Also prevent event bubbling Bubbles and default behavior:

return false;
Copy after login

The above is the detailed content of Detailed explanation of the use of

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template