Custom Jquery Is Not Working In Wordpress
I have written JQuery for my website search functionality. Its working fine when I am using separate file. But when I included same JQuery file in wordpress its not working as requ
Solution 1:
Firstly, ensure you have WordPress loading onto your template.
In your head file, ensure you have this loaded in
<?php wp_enqueue_script("jquery"); ?>Next, WordPress has to use noConflict mode or use the base jQuery call instead of $.
Try this
jQuery('#search').keyup(function () { 
    var filter = jQuery('#search').val();
    jQuery('.et_pb_row').each(function() {
        jQuery(this).find("h3:not(:contains('" + filter + "'))").parent().hide();
        jQuery(this).find("h3:contains('" + filter + "')").parent().show();
    });
});
You should also ensure that all your jQuery code is wrapped in the following code:
jQuery(document).ready(function() {
    //code to run here
});
Solution 2:
You have to try some trial and error method in fact.It can be because of jquery conflicts.
These are the possibilities coming in mind
- Try placing your jQUERY code above and below of - wp_head();
- Check if you are using the latest version of jquery file( or check if you use the same jquery file of the working file ) 
- Try placing your jQUERY code above and below of jquery file 
Post a Comment for "Custom Jquery Is Not Working In Wordpress"