使用 jQuery 更改标签内的标签详细信息
Change details of the tag inside the tag with jQuery
希望能把我的问题解释清楚
<button type="button" class="" id="myId">
<p style="color: red;">hello</p>
</button>
如果我只知道此标签位于 ID 为 "myId"
的 <button>
标签中,如何使用 [=16] 更改标签 <p style="color: red;">hello</p>
的属性 style
=]?
$('button#myId').find('p').css('color','red')
或
$('button#myId').children().css('color','red')
如果按钮中有多个元素,则在使用 children() 时必须具体说明。
希望能把我的问题解释清楚
<button type="button" class="" id="myId">
<p style="color: red;">hello</p>
</button>
如果我只知道此标签位于 ID 为 "myId"
的 <button>
标签中,如何使用 [=16] 更改标签 <p style="color: red;">hello</p>
的属性 style
=]?
$('button#myId').find('p').css('color','red')
或
$('button#myId').children().css('color','red')
如果按钮中有多个元素,则在使用 children() 时必须具体说明。