Title: jQuery error from inline function
Last modified: November 16, 2022

---

# jQuery error from inline function

 *  Resolved [scooterlord](https://wordpress.org/support/users/scooterlord/)
 * (@scooterlord)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/)
 * Hello, hope you are well! Thanks for the plugin, currently evaluating it for 
   purchase.
 * Currently I am getting a jquery error from the inline function that is created
   by the plugin:
 *     ```
       (function($){
                   $(document).ready(function(){
                       if($('.pf-button-content').length === 0){
                           $('style#pf-excerpt-styles').remove();
                       }
                   });
               })(jQuery);
       ```
   
 * I get an error that Jquery is not defined – and this is expected since the script
   is localized.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Print & PDF by PrintFriendly](https://wordpress.org/support/users/printfriendly/)
 * (@printfriendly)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/#post-16208260)
 * I didn’t understand “script is localized”. Please share the URL where PrintFriendly
   button is used.
 *  Thread Starter [scooterlord](https://wordpress.org/support/users/scooterlord/)
 * (@scooterlord)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/#post-16209129)
 * Hello and thank you for the fast response. By localized I mean it’s enqueued 
   within the functions.php.
 * I am still working on this locally so, I am afraid there is no link. Below is
   a screenshot of what the error I am getting:
 * > [View post on imgur.com](https://imgur.com/a/PESWijf)
 *  Thread Starter [scooterlord](https://wordpress.org/support/users/scooterlord/)
 * (@scooterlord)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/#post-16209149)
 * By running the code in the console I get ‘undefined’.
 * However, if I remove the following it works:
 * (function($){
 * })(jQuery);
 *  Plugin Author [Print & PDF by PrintFriendly](https://wordpress.org/support/users/printfriendly/)
 * (@printfriendly)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/#post-16209741)
 * We use `wp_enqueue_script` to load jQuery. [https://developer.wordpress.org/reference/functions/wp_enqueue_script/](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)
   
   as WordPress includes jQuery by default
 * I don’t understand the modifications that you have done that made this stop working.
   That’s what I was trying to understand.
 *  Thread Starter [scooterlord](https://wordpress.org/support/users/scooterlord/)
 * (@scooterlord)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/#post-16210949)
 * Hello again. I apologize for wasting your time but this was a ‘me’ problem.
 * I was deregistering jquery for an older version and something must have bothered
   it; I didn’t have problem with any of the other jquery scripts I was loading (
   bootstrap, custom, etc) so it led me to think it was something else.
 * I appreciate the fast response though and this is indicative of the quality of
   the plugin. Thank you!
 *  Plugin Author [Print & PDF by PrintFriendly](https://wordpress.org/support/users/printfriendly/)
 * (@printfriendly)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/#post-16211670)
 * Glad to hear that it is sorted!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘jQuery error from inline function’ is closed to new replies.

 * ![](https://ps.w.org/printfriendly/assets/icon-256x256.png?rev=2951152)
 * [Print, PDF, Email by PrintFriendly](https://wordpress.org/plugins/printfriendly/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/printfriendly/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/printfriendly/)
 * [Active Topics](https://wordpress.org/support/plugin/printfriendly/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/printfriendly/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/printfriendly/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Print & PDF by PrintFriendly](https://wordpress.org/support/users/printfriendly/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/jquery-error-from-inline-function/#post-16211670)
 * Status: resolved