Created
November 25, 2019 14:32
-
-
Save mido1983/951004976efbecb0bfc870d5888b281c to your computer and use it in GitHub Desktop.
JQuery is not working in wordpress – Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Problem | |
The jQuery is not working in WordPress plug-in writing? When you try to test a simple jQuery effect like following */ | |
$(document).ready(function(){ | |
alert('test'); | |
}); | |
Solution | |
In WordPress, the$() syntax is always used by other scripting library, and causing the conflict issue and fail to call the jQuery function. You should use jQuery() instead… | |
jQuery(document).ready(function(){ | |
alert('test'); | |
}); | |
Copy | |
Alternatively, you can use noConflict() … | |
$j=jQuery.noConflict(); | |
// Use jQuery via $j(...) | |
$j(document).ready(function(){ | |
alert('test'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment