TypeError: matchExpr[type].exec is not a function

遇到了這個問題,好久沒找到答案,後來使用了萬能的google,貌似也沒找到答案.javascript

詳細描述下:html

經過使用 $(".select")來選擇jqeury對象,沒問題.java

經過$(".select").find(".ccc") 也沒問題jquery

經過$(".select").find(".ccc div") 或者 $("select").find("div.ccc") 問題來了,不能經過find來找target.搜索引擎

 

國內搜索引擎沒找到相關解決方法,只能去試試google了,運氣好,google還真打開了.google

 

但一樣沒找到解決方案.spa

 

看了別人在jquery對這個報錯的的反饋,以下:prototype

<!DOCTYPE html>
<html>

<body>
<input type='button' name='btn' value='click'/>

<script>
        Object.prototype.toQueryString = function () {}
</script>

<script src='jquery-1.10.2.js' type='text/javascript'></script>
<script>

$("[name='btn']");

</script>

</body>
</html>

發現了一些共同之處:在Object的原型上擴展本身的方法.code

我就嘗試去把本身代碼裏的object擴展給刪了試試,果真能夠了.htm

 

其實不用擴展也沒問題的,能夠用全局方法或者工廠方法代替的.

相關文章
相關標籤/搜索