Storing HTML or XML code in javascript variables

前端 未结 4 1576
悲&欢浪女
悲&欢浪女 2021-01-21 14:16

I\'d like to store a some HTML/XML markups in a javascript variable. The problem is that the text is relatively large. For example how can I store the following XML piece in a j

4条回答
  •  囚心锁ツ
    2021-01-21 14:53

    I think you might have wanted to store html/xml code in javascript and display in textarea or some other input elements. If this is your intention this will help you.

    Instead of javascript variable, store your code in a div and hide using css ex: display:none. When you want to show the code, you can use $('#div id').text().

提交回复
热议问题