admin管理员组文章数量:1334912
I have a label in a div .
<div id="mydiv">
<label>text</label>
</div>
how to write a selector to access the label and change the text .
I have a label in a div .
<div id="mydiv">
<label>text</label>
</div>
how to write a selector to access the label and change the text .
Share Improve this question edited May 24, 2015 at 18:14 Krutik Jayswal 3,1751 gold badge17 silver badges38 bronze badges asked Jan 31, 2015 at 10:43 Surya Prakash TummaSurya Prakash Tumma 2,2034 gold badges29 silver badges50 bronze badges 1-
5
$('#mydiv label').text('Hello Kitty')
– adeneo Commented Jan 31, 2015 at 10:44
1 Answer
Reset to default 8Use:
$('#mydiv label').text('smtext');
Update: to change second label element in mydiv:
$('#mydiv label:eq(1)').text('smtext');
本文标签: javascripthow to change label text in a div using jqueryStack Overflow
版权声明:本文标题:javascript - how to change label text in a div using jquery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742378726a2463685.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论