我有这样的代码获取文本与jQuery
<input type="checkbox"/>
<span>Foobar</span>
<input type="radio" checked="checked">Foo
<input type="radio">Bar
如何获取文本Foo
使用jQuery其中$(this)
是节点<input type="checkbox"/>
?
我可以通过$(this).parent().find(":checked").not($(this))
得到<input type="radio" checked="checked">
,但我不知道如何获得文本。
这是不正确的HTML,所以你可能有麻烦 – 2012-01-09 14:35:32
@ m.edmondson:什么是不正确的HTML? – 2012-01-09 14:36:30
没有关闭它们应该是''Foo或' Foo'还是我误会了? – 2012-01-09 14:37:43