Js not working in sidebar/widget
-
I have an odd situation in a plugin I have authored
in functions file :
add_action( ‘wp_enqueue_scripts’, ‘bsp_enqueue_search’ );
function bsp_enqueue_search() {
wp_enqueue_script( ‘bsp_enqueue_search’, plugins_url(‘js/bsp_enqueue_search.js’,dirname( __FILE__ )) );
}
The bsp_enqueue_search.js’ file isjQuery(document).ready(function($) { $('#bsp_search_submit1').click(function() { $('#bsp_search_submit1').hide(); $('#bsp_search_submit2').show(); }); });
If you go to
https://gos.rewweb.co.uk/index/search/
This has the bbpress search and a wordpress search.
and click the bbpress search in the body, then ‘searching’ with a spinner appears. If you click the same in the sidebar ‘Search Forums’ it does not, but it is the same form being called, and all the code is there if you inspect, but the js is clearly not being implemented.
But if you click the WordPress search first, and then click the ‘search forums’ it works
Can anyone assist is resolving – is it some load order issue?
- The topic ‘Js not working in sidebar/widget’ is closed to new replies.