javascript - Wordpress : ReferrenceError $ not defined -
i using wordpress , trying access code snippet .it's showing error in last line }(jquery));
(function($) { $(function () { // slideshow 3 $("#slider3").responsiveslides({ auto: true, pager:true, nav:false, speed: 500, namespace: "callbacks", before: function () { $(".events").append("<li>before event fired.</li>"); }, after: function () { $(".events").append("<li>after event fired.</li>"); } }); }); }(jquery));
it's showing referrence error : $ not defined .i have searched in stackoverflow din't found correct solution.please let me know doing wrong. note : have placed main jquery script above gets included first before other script.
typically how setup javascript file using wordpress.
add code either header or footer, depending on application makes difference:
<script type="application/x-javascript"> jquery(document).ready(function() { your_javascript_function('add variables here'); }); </script>
then modify script this:
function your_javascript_function(vars) { // slideshow 3 $("#slider3").responsiveslides({ auto: true, pager:true, nav:false, speed: 500, namespace: "callbacks", before: function () { $(".events").append("<li>before event fired.</li>"); }, after: function () { $(".events").append("<li>after event fired.</li>"); } }); }
if still receiving error try adding $ js here:
jquery(document).ready(function($) {
if doesn't work change $ jquery.
if doesn't work else causing issues.
Comments
Post a Comment