我有一个简单的按钮:
<button type="button" id="somebutton" value="start">blah</button>
在jQuery中,在bind('click,function(){....
我有这个:
$(this).attr("value")
当然,这样做是获取属性的值,在这种情况下为:“开始”。好的,这在firefox中有效,我得到正确的“开始”值。但是在IE 7中,我得到的值是“ somebutton”。
为什么?
最佳答案
我以前遇到过。我不知道为什么<button>
会发生这种情况。它可能是jQuery中的错误,或者可能是IE中的错误,或者可能是两者的结合。
最后,我选择使用标准的<input type="button"/>
来解决此问题。