How to gracefully Add HTML code with JS dynamic?

Source: Internet
Author: User
Tags script tag

Write the desired structure in HTML and wrap it with a display:none tag.

In general, you will use:

    • Label not set to Type= "Text/javascript" script
    • textareaLabel
<Script Type="Text/html"Id="Thetemplate" > Writing your HTML structure </SCRIPT> 

or
<textarea id="theTemplate" style="display:none">
编写你的html结构
</ Textarea>
  These tags are used to prevent these tags from being directly used by browsers from being rendered when they are read by the browser. And if you do, the IMG SRC will not be automatically retrieved by the browser. 

If you use the script tag, you can get it in the following code:
//Use script packagevar template =document.getElementById ( "Thetemplate").   InnerHTML   ; var template =  document.getelementbyid ( Span class= "hljs-string" > "Thetemplate").  Value   ; 

.

    

How to gracefully Add HTML code with JS dynamic?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.