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 .
Other than noConflict, this is helpful too:
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):I was able to resolve this very easily my simply enqueuing jQuery
wp_enqueue_script("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:
If
$
is not undefined, and$ === jQuery
logs false, you definitely have a conflict on your hands. Replacing your$
withjQuery
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 notundefined
should be left alone, of courseJust add this:
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/
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:
You can also use jQuery's API using
noConflict();
Another example of using noConflict without using document ready:
You could even choose to create your very alias to avoid conflicts like so:
Yet another longer solution is to rename all referances of $ to jQuery:
$( "div p" ).hide();
tojQuery( "div p" ).hide();