开发者

How to get the content of a tag inside a label

How can get the content of the b tag?

<label for="onde">
    <b>qua qua text</b>
    <textarea name="onde"></textarea>
&开发者_如何学编程lt;/label>

I am trying this with no success:

$('textarea[name=onde]').prev().val();


$('label[for="onde"] b').text();

should do it


You were close:

$( 'textarea[name="onde"]' ).prev().text()

Live demo: http://jsfiddle.net/5Y3Q8/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜