JQuery UI button not working in the Wordpress 5.8 theme
I have enqueued the necessary scripts via wp_register_script
and wp_enqueue_script
in Wordpress (v 5.8):
script type='text/javascript' src='https://mywebsite.com/wp-includes/js/jquery/jquery.js?ver=3.6.0' id='jquery-core-js'/script
script type='text/javascript' src='https://mywebsite.com/wp-includes/js/jquery/ui/core.js?ver=1.12.1' id='jquery-ui-core-js'/script
script type='text/javascript' src='https://mywebsite.com/wp-includes/js/jquery/ui/tabs.min.js?ver=1.12.1' id='jquery-ui-tabs-js'/script
script type='text/javascript' src='https://mywebsite.com/wp-includes/js/jquery/ui/button.js?ver=1.12.1' id='jquery-ui-button-js'/script
I'm trying to apply JQuery UI buttons (on 'anchor' and 'button' tags with class 'jqbtn'):
$pxt(.jqbtn).button();
But the the buttons are not rendered (The required classes like 'ui-button', 'ui-corner-all' and 'ui-widget' are not added). There is no error in the console. Please help. Am I missing something?
Note: JQuery UI tabs are rendered perfectly by:
$pxt(.jqtabs).tabs();
Hack:
$pxt(.jqbtn).addClass('ui-button ui-corner-all ui-widget');
solves the problem. But why is the actual piece of code not working?
Topic jquery-ui buttons wp-enqueue-script Wordpress
Category Web