用jQuery编写HTML [英] Writing HTML with jQuery

查看:77
本文介绍了用jQuery编写HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是jQuery的新手。我想用jQuery编写下面的HTML(以及类)。

I am new to jQuery. I want to write the following HTML (along with the classes) using jQuery. How can I do this?

<div class="phnbr">
  <div class="phtext">hi how are you, <a target="_blank" href="http://www.xyz.com">click here.</a>
  </div>
</div>


推荐答案

$('<div class="phnbr"> \
  <div class="phtext">hi how are you, <a target="_blank" href="http://www.xyz.com">click here.</a> \
  </div> \
</div>'); // bang done!

这篇关于用jQuery编写HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆