I might have an error in a .js document in a theme I have purchase:
$('.tagcloud a').wrap('<span class="st_tag" />');
I am trying to solve it but I am not a programmer so I don't know how. The site is this: http://www.framerental.com .
I might have an error in a .js document in a theme I have purchase:
$('.tagcloud a').wrap('<span class="st_tag" />');
I am trying to solve it but I am not a programmer so I don't know how. The site is this: http://www.framerental.com .
You use jQuery.noConflict(); So $ is undefined.
You can read more about it here docs
Try to modify your code in this way (add $ sign to ready function):
jQuery(document).ready(function($) {
// Code that uses jQuery's $ can follow here.
});
Function errors are a common thing in almost all content management systems and there is a few ways you can approach this.
Wrap your code using:
<script>
jQuery(function($) {
YOUR CODE GOES HERE
});
</script>
You can also use jQuery's API using noConflict();
<script>
$.noConflict();
jQuery( document ).ready(function( $ ) {
// Code that uses jQuery's $ can follow here.
});
// Code that uses other library's $ can follow here.
</script>
Another example of using noConflict without using document ready:
<script>
jQuery.noConflict();
(function( $ ) {
$(function() {
// YOUR CODE HERE
});
});
</script>
You could even choose to create your very alias to avoid conflicts like so:
var jExample = jQuery.noConflict();
// Do something with jQuery
jExample( "div p" ).hide();
Yet another longer solution is to rename all referances of $ to jQuery:
$( "div p" ).hide(); to jQuery( "div p" ).hide();
Instead of doing this:
$(document).ready(function() { });
You should be doing this:
jQuery(document).ready(function($) {
// your code goes here
});
This is because WordPress may use $ for something other than jQuery, in the future, or now, and so you need to load jQuery in a way that the $ can be used only in a jQuery document ready callback.
Just add this:
<script>
var $ = jQuery.noConflict();
</script>
to the head tag in header.php . Or in case you want to use the dollar sign in admin area (or somewhere, where header.php is not used), right before the place you want to use the it.
(There might be some conflicts that I'm not aware of, test it and if there are, use the other solutions offered here or at the link bellow.)
Source: http://www.wpdevsolutions.com/use-the-dollar-sign-in-wordpress-instead-of-jquery/
Either you're not including jquery toolkit/lib, as some have suggested, or there is a conflict of sorts. To test: include jQuery and test like this:
console.log($);
console.log($ === jQuery);
If $ is not undefined, and $ === jQuery logs false, you definitely have a conflict on your hands. Replacing your $ with jQuery solves that, but that can be quite tedious (all that extra typing...). Generally I start my scripts with $jq = _$ = jQuery; to at least have a shorter reference to the jQuery object.
Of course, before you do that, check to see if you're not accidentally overriding variables that have been set beforehand: console.log($jq, _jQ, _$); whichever is not undefined should be left alone, of course
jQuery(document).ready(function($){ function, which you should. Also, the resizeWindow should get its with from $(this).width(); rather then jQuery(window).with(); but perhaps most importantly: the error says it all: there's a typo in your code: just search your code for resiza window, and replace it with resizeWindow...There is an easy way to fix it. Just install a plugin and active it. For more : https://www.aitlp.com/wordpress-5-3-is-not-a-function-fix/ .
Tested with Wordpress version 5.3.
I noticed that no one mentioned this:
The version of jQuery that WordPress ships with doesn't support using $, which means that updating the jQuery version will resolve the error.
wp_deregister_script('jquery');
wp_register_script( 'jquery', "https://code.jquery.com/jquery-3.7.1.min.js", array(), '3.7.1' );
(As of writing this,the latest jquery is 3.7.1)
I had the same issue with jquery in my WordPress site I solved it by rearranging my scripts.
if aowl loads first in my site then I have the error mention on a question.
and make sure jquery loads first before aowl carousel script, and then add below code the error should not appear. hope it may help someone in the future.
jQuery(document).ready(function($) {
// Code that uses jQuery's $ can follow here.
});
You can replace $ by jQuery.
Happy coding !
jQuery might be missing.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>