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 .
$ is not a function WordPress error occurs when the code comes before the jQuery library. For example, if a plugin or theme calls a code before calling the right library, you get this error. By default, WordPress doesn't understand $ as jQuery and you have to make some modifications to fix this error.
This is a standard JavaScript error when trying to call a function before it is defined. This error occurs if you try to execute a function that is not initialized or is not initialized correctly. This means that the expression did not return a function object.
This is a common JavaScript error that happens when you try to call a function before it is defined. You get this error when you try to execute a function that is uninitialized or improperly initialized . It means that the expression did not return a function object.
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();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With