0
DOM元素
<span onclick="show(this)">foobar</span>
function show(theSpan) {
....... //select the span here
}
我怎么能使用jQuery选择器选择的跨度?我尝试了$(theSpan),但它不起作用。我想选择它作为一个Jquery对象,以便我可以将attr()应用于它。
谢谢!
你说“不工作”的意思。它会抛出任何错误? – Asdfg 2012-07-13 20:25:06
什么是你想要的跨度? – 2012-07-13 20:26:36
yes $(theSpan).attr('test,'123');工作正常。 – eastboundr 2012-07-13 20:28:59