0

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?

1
  • Have you resolved the issue? How? If not, can you show your PHP code which enqueues the scripts and the one that outputs the HTML for the buttons (and tabs)? And basically, all the relevant code. Also, is this in a plugin or theme?
    – Sally CJ
    Aug 16, 2021 at 14:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.