如何呈现脚本标记内的html [英] How to render html which is within script tag
本文介绍了如何呈现脚本标记内的html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些html内容,它们位于标签中,我想在浏览器中运行代码时呈现此html.代码如下.
Hi i have some html content which is within the tag i want to render this html when i run the code in browser. the code is following.
<script>
<div class="wrapper">
<header class="clearfix">
<div class="container"> <a id="logo" href="index.html">Login</a>
<ul class="social-icons">
<li><a href="#" class="icon flip">Sign Up |</a></li>
<li><a href="" class="icon">Forget Password</a></li>
</ul>
</div>
</header>
<section>
<article class="clearfix" >
<aside role="complementary" class="shadow">
<div id="error"></div>
<form class="c-form" name="login" id="login">
<input type="text" id="user-name" name="email" value="User Name">
<input type="text" id="password" name="password" value="Password">
<input type="submit" class="button green" value="Sign Up">
</form>
</aside>
</article>
</section>
</div>
</script>
请提前帮助谢谢.
推荐答案
只需为脚本标签提供一个ID,选择该标签并附加其html内容.在这里看到 http://jsfiddle.net/rohhittt/zwMNr/
Simply give the script tag an id, select that tag and append its html content. See here http://jsfiddle.net/rohhittt/zwMNr/
$(document).ready(function(){
$('body').append($("#scriptId").html());
});
这篇关于如何呈现脚本标记内的html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文