jQuery添加文本以跨div [英] jQuery add text to span within a div

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

问题描述

<div id="tagscloud">
       <span></span>
</div>

如何在跨度内添加一些文本,如下面的代码?

How would I do to add some text within the span like code below ?

<span>**tag cloud**</span>

修改: 实际上跨度有一个ID

Edit: actually the span has an id

<div id="tagscloud"> <span id="WebPartCaptionWPQ2"></span> </div>

推荐答案

您可以使用:

$("#tagscloud span").text("Your text here");

相同的代码也适用于第二种情况.您还可以使用:

The same code will also work for the second case. You could also use:

$("#tagscloud #WebPartCaptionWPQ2").text("Your text here");

这篇关于jQuery添加文本以跨div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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