Unable to uncheck checkbox with jquery in wp admin

Can you please clarify your question? Are you attempting to make a checkbox that can clear all checkboxes and also recheck all checkboxes by checking that one checkbox? Also a checked input would be written like this: <input id=”editor-post-taxonomies-hierarchical-term-48″ class=”editor-post-taxonomies__hierarchical-terms-input” type=”checkbox” checked value=”48″ /> You can do this: $(‘div[aria-label=”Asukohad”] input[type=”checkbox”]’).on(“change”, function() { var element = … Read more

Cannot prefill hidden Ninja Forms fields

According to https://developer.ninjaforms.com/codex/changing-field-values/ you need to add .trigger( ‘change’ ) when changing Ninfa Forms field values programmatically. This should work: if(jQuery(‘#broker-list’).length) { //checks if the list exists jQuery(document).on( ‘nfFormReady’, function( e, layoutView ) { var broker_name = “”; jQuery(document).on(“click”, “.broker” , function() { broker_name = jQuery(‘.broker__name’, this).text(); console.log(broker_name); // this works perfectly if(jQuery(‘#nf-field-33’).length) { jQuery(this).val(broker_name).trigger( … Read more

How to stop focus() in custom js from scrolling to footer?

In jQuery focus by default scroll the page to the element. If we use focus({preventScroll: true}) our copy function will not work as you mension. So I have use some css hack. See the following jQuery code. function copyToClipboard(selector, event){ event.preventDefault(); var $temp = jQuery(“<div>”); jQuery(“body”).append($temp); $temp.attr(“contenteditable”, true) .html(jQuery(selector).html()).css(‘position’, ‘fixed’).select() .on(“focus”, function() { document.execCommand(‘selectAll’,false,null); }) … Read more

Jquery integration with my theme

I think the main problem is that you need to use a no-conflict wrapper when calling tab slideout. However, rather then simply point out the problem i’m going to cover some things you should be doing to make this script work “The WordPress Way” ..(ie. using an enqueue and hooking onto an appropriate hook to … Read more

Include jQuery plugin in WordPress

A better method is to use the built in WordPress hooks in your functions.php with conditionals if needed ( for instance to load it only on certain pages). For hooking into admin you can use admin_print_scripts for hooking into the front you can use wp_print_scripts or one of the many other action hooks. For example: … Read more

Best way to include jQuery and fire with script at bottom of container

You typically should use the jQuery version that’s built in. There are instances where you might want to use wp_dequeue_script(‘jquery’) and then add a different version of jQuery. Here’s the best way to add a script dependent on jQuery: function theme_register_scripts(){ wp_enqueue_script(‘jquery’); wp_enqueue_script(‘myscript-name’, get_bloginfo(‘stylesheet_directory’) . ‘/js/myscript.js’, array(‘jquery’)); } add_action(‘wp_print_scripts’, ‘theme_register_scripts’); The third argument of wp_enqueue_script … Read more