1. 程式人生 > >js方法不能與jquery方法同時用

js方法不能與jquery方法同時用

nbsp 問題 element div 原生 post attribute () 答案

困擾我一天的問題,終於知道原因了:

js方法不能與jquery方法同時用!!!
度娘找到了答案:例如

attr("name") 是jquery對象的方法,原生js的方法是getAttribute()。

代碼可以寫成$(element).attr("name")或者element.getAttribute("name")。

js方法不能與jquery方法同時用