getJSON response to PHP

After more reading and testing, i’ve realised that i misunderstood how AJAX works, therefore it was never gonna work the way i thought it would. For those who come across this, i hope this will help. In shortcode function i generated the api url with params specific to the page where shortcode is called. eg … Read more

Elementor form – checkboxes validation

For anyone interested, I was able to resolve it like so: function form_checkboxes_validation(){ ?> <script type=”text/javascript”> (function($){ $(“#send-request”).click(function(){ if(! $(‘input[name=”form_fields[suite][]”]’).is(‘:checked’)) { alert(“Please select at least one suite!”); return false; } }); })(jQuery); </script> <?php } add_action(‘wp_footer’, ‘form_checkboxes_validation’);

Animated Accordion [closed]

Since you already loading JQuery, add the following $(‘document’): (function($) { $(window).load(function() { //lets wait for all to be loaded alert(“Accordion script loaded”); var acc = document.getElementsByClassName(“accordion”); var i; for (i = 0; i < acc.length; i++) { acc[i].onclick = function() { this.classList.toggle(“active”); var panel = this.nextElementSibling; if (panel.style.maxHeight){ panel.style.maxHeight = null; } else { … Read more

Override default options in plugin metaboxes

as example of js code that will run on every new post page function admin_footer_se_119285(){ ?> jQuery(window).ready(function(){ if (jQuery(‘#metabox-id-div’).length == 1){ // put your code } }) <?php } ?> Take a look to usefull reference to admin_footer-(plugin_page) action hook

Fire an event after Featured Image selection

I figure it out. This may be a bad solution but atleast it works $(‘.inside’).bind(‘DOMNodeInserted DOMNodeDeleted’, function(event) { //WRITE WHAT YOU NEED TO DO} Inside a file abhiScript.js (could be any filename 🙂 ) and wp_enqueue_script( ‘SimpleScript’, get_template_directory_uri() . ‘/assets/js/abiScript.js’,array(‘jquery’)); in function.php

How to enqueue script before jQuery? [duplicate]

If I understood you correctly: This might help you out: Using requirejs with wordpress If you are just trying to enqueue requirejs with jquery: Look at this documentation: WordPress Enqueue Scripts Documentation So in your case it would look something like this: wp_enqueue_script( ‘script’, get_template_directory_uri() . ‘PATH TO YOUR REQUIREJS FILE’, array ( ‘jquery’ ), … Read more