Reputation: 65
I have a small javascript file (alg-wSelect.js) which has only one line of code: jQuery('select.alg-wselect').wSelect(); It's called by a wordpress plugin. Is it possible to add it on another javascript file or include it inline? How can I do that? Thank you in advance
Upvotes: 2
Views: 1015
Reputation: 3673
This can be done using wp_add_inline_script. Please find the code below :
wp_enqueue_script( 'handel', 'JS FILE PATH' , array(), 'version', true );
$integrate_script="jQuery('select.alg-wselect').wSelect()";
wp_add_inline_script( 'handel', esc_js($integrate_script) );
wp_add_inline_script it will add script inline to the previously enqueue script. Please read about the function from here
Upvotes: 2