最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeError: jQuery(...).on is not a function - Stack Overflow

programmeradmin3浏览0评论

Guys I have this function from a wordpress plugin:

jQuery( '#widget-twitter-__i__-username' ).on( 'change', function() {
  jQuery('#widget-twitter-__i__-list' ).val(0);
});

jQuery( '#widget-twitter-__i__-list' ).on( 'change', function() {
  jQuery('#widget-twitter-__i__-username' ).val(0);
});

The error I am getting is:

TypeError: jQuery(...).on is not a function

When I click that error on the error console, I get to the above code.

And I was wondering what would be the way to address this issue.

Guys I have this function from a wordpress plugin:

jQuery( '#widget-twitter-__i__-username' ).on( 'change', function() {
  jQuery('#widget-twitter-__i__-list' ).val(0);
});

jQuery( '#widget-twitter-__i__-list' ).on( 'change', function() {
  jQuery('#widget-twitter-__i__-username' ).val(0);
});

The error I am getting is:

TypeError: jQuery(...).on is not a function

When I click that error on the error console, I get to the above code.

And I was wondering what would be the way to address this issue.

Share Improve this question edited Apr 16, 2016 at 11:56 fredmaggiowski 2,2483 gold badges28 silver badges44 bronze badges asked Sep 23, 2013 at 12:03 JeremyJeremy 9734 gold badges15 silver badges26 bronze badges 3
  • 7 jquery version used? – Arun P Johny Commented Sep 23, 2013 at 12:04
  • 3 this method is not available in jQuery < 1.7 – Arun P Johny Commented Sep 23, 2013 at 12:04
  • 1 @A.Wolff since it is saying jQuery(...).on I think jQuery is loaded, but a old version else it has to say jQuery is undefied – Arun P Johny Commented Sep 23, 2013 at 12:06
Add a ment  | 

1 Answer 1

Reset to default 12

If your jQuery version is under 1.7 i'd suggest using .delegate() or .live() or update your jQuery to the latest version

jQuery( '#widget-twitter-__i__-list' ).delegate(

or

jQuery( '#widget-twitter-__i__-list' ).live(
发布评论

评论列表(0)

  1. 暂无评论