简体   繁体   中英

jquery function in wordpress not loading in mobile

I'm using this jquery script to filter content from a html table. http://jsfiddle.net/7BUmG/2/ The search bar works great when I type on the keyboard on desktop and mobile using the touchscreen.

I tried to load the same script in a wordpress page but it was not working. so I tried to wrap the code in this function

(function($) {

})(jQuery);

I think this is a method used for compatibility with wordpress jquery library. It works fine in desktop but now the keyup event does not work on mobile.

WordPress dont't understand $ as jQuery and you have to make some modifications to fix this error. You can try wrap:

jQuery(function($){
    // your code jquery here
}); 

or

jQuery(document).ready(function($) {
    // your code jquery here
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM