2018年12月6日 星期四

[jquery] noConflict Uncaught TypeError: $(...).tablesorter(...) is not a function 解決



使用 jQuery tablesorter 2.0 https://mottie.github.io/tablesorter/docs/ 的時候發生
Uncaught TypeError: $(...).tablesorter(...) is not a function
的問題
原來是與jquery 中使用 $ 符號發生衝突,
可以使用  $.noConflict(); 來解除這個狀況,處理這個問題。

jQuery.noConflict() | jQuery API Documentation https://api.jquery.com/jquery.noconflict/
谈谈 jQuery 中的防冲突(noConflict)机制 | Taobao FED | 淘宝前端团队 http://taobaofed.org/blog/2013/03/12/jquery-no-conflict/
Uncaught TypeError: $(...).tablesorter(...) is not a function · Issue #1179 · Mottie/tablesorter https://github.com/Mottie/tablesorter/issues/1179



沒有留言:

張貼留言