WordPress jQuery error: $ is not a function, related to bskit & plugins jscript files

Greetings!

I’m getting the ole $ is not a function error from both the bskit & plugins files. Employing adding the lastest jQuery “enqueue trick” at the end of functions.php is not solving the problem.

I am not certain jQuery is loading.

Any thoughts on how to address this issue?

Thanks!

Jon

Hi @JMunsonII, that is beyond me, but have you joined and checked over on our slack channel too?
pinegrow-webeditor@slack.com
?

Just in case the response time is a little better.
it has got a little…er…slack around here sometimes…
so try both places

Thanks!

Funny, I read over on the Slack channel to post here instead… :rofl:

But, yes, I am over there too.

1 Like

NOTE: I did solve the error problem. I have no idea what was actually causing it, but fixed it.

To fix: In the bskit file (I made a backup copy first) I simply replaced all occurances of “$(” with “jQuery(” and got rid of those errors. Did the same with the line in the plugins files. No more error message.

Yes, its an odd one… the more users we get… the quieter these active spaces become!
Bizarrre.

@itsmeleo is usually the man for such jquery/enqueuing questions (i say, clutching at straws) this time of night it gets a little quieter around here but… he is 5 hours ahead of me so. its 3am with him.
Awkward! :slight_smile:
I will have a look in our docs too.

have you checked them BOTH out.

tbh, you will have more chance of hitting SEARCH results in our OLDER docs.

the newer docs are shinier and better laid out and more current, but you will get better search box results in the older docs site

edit!
ah! your too smart.
i was still typing my .now obsolete… response to you :smiley:so great on nailing it!

mmmm and what was an example line, replaced with , example line wise?
I cant put those snippets into context in my head?

an example would be:

$(document).ready(function() {
   ...
});

getting turned into:

jQuery(document).ready(function() {
   ...
});

It has been a while since I’ve been on a doc hunt… :wink:

Ha, great! thanks. Yes, that was rather easy to understand, now I …
Sorry, I was a in Dufus mode…

The jQuery case

One useful thing to know when you start your journey into Theme developement is that WordPress already loads jQuery, but in noConflict mode.

The purpose of noConflict mode is to help ensure there are no compatibility problems between jQuery and other javascript libraries loaded into WordPress. In short, noConflict mode means that the standard $ short cut used in jQuery (and other javascript libraries) is not usable, and must be replaced with jQuery.

While there are several ways to modify your scripts to be WordPress compliant and because having HTML converted to PGWP theme out-of-the-box is sacred for us, we have decided of a compromise.

Our solution is to automatically “Deregister” the jQuery loaded by WordPress first and then replace it with the jQuery from your theme. By doing this, the noConflict constraint is removed and you can use ALL your javascripts without any modifications.

NOTE: There are Pros and Cons about replacing the standard WordPress jQuery so when the theme is done, exported and ready for production, WordPress advanced developers can still decide to modify FUNCTIONS.PHP, switch back to WordPress jQuery and update/modify their JS script if necessary.

See: http://docsbeta.pinegrow.com/enqueuing-scripts-and-stylesheets/

1 Like

That may be, however, even that Pinegrow has done so did not eliminate the error - I still had to replace the $ call with jQuery.

This is interesting!
Thanks you two, keep up the questioning and explaining