Loading jquery locally

Although it seems like you should be able to just call the function and have it load the script, it’s slightly more complicated. Instead, scripts need to be registered and enqueued inside a hook, so they’re loaded in the right order. To get jQuery loaded on the front end of your theme wrap the function … Read more

why is my wordpress Jquery-Ajax call not working?

You need to change the data that you are sending in the ajax request. For ajax to work in WordPress you need to send the action variable in ajax post request. Change data: {package: package}, to data: {action: ‘ajaxAutopopulate’, package: package} Also you can use the wordpress default function wp_send_json( $response ) for encoding of … Read more

How to change the text of the “You are about to permanently delete these items…” alert message when deleting media from the media library?

You could use the gettext filter. See the examples here https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext. In your filter you will add code to check IF it’s the exact text you want to change then if the users meta value is what you are looking for the return the revised text. Else return the passed text unchanged.

How to add plugin with jQuery to custom theme?

It should be said, that WordPress comes with jQuery out-of-the-box. You can check it, if you slap this in your page-template (based on this post): window.onload = function() { if (window.jQuery) { // jQuery is loaded alert(“Yeah!”); } else { // jQuery is not loaded alert(“Doesn’t Work”); } } In case you need other scripts, … Read more

underscore template dynamically remove row Jquery

This isn’t WP related but Its not working because you are trying to add an event to a dynamically created element. Replace… jQuery( ‘.remove_field’ ).on(“click”, function(e){ e.preventDefault(); jQuery(this).parent(‘div’).remove(); }); With jQuery( ‘body’ ).on(“click”, ‘.remove_field’, function(e){ e.preventDefault(); jQuery(this).parent(‘div’).remove(); }); You can read more about your issue here.

Accessing javascript in multiple files [closed]

You have to create a dependency with wp_register_script($handle, $src, $dependency, $version, true/false); See WP codex: wp_register_script and then make sure that the second file is loaded correctly and right after the initial script. The third parameter is an array for dependencies/other “handles”. So..in your case: <?php // Functions.php or somewhere else wp_register_script(‘my_first_script’,get_template_directory_uri().’/js/my-first-script.js’, array(‘jQuery’), ‘1.0’, true); … Read more

How to keep HTML form field that is conditional hidden with javasript hidden after page reload?

Try this code: // Conditionally show price (function ($) { window.onload = function() { if ($(“#select_price_option”).val() == “I need more information”) { $(‘#price_input_div’).hide(); } $(“#select_price_option”).change(function() { if ($(this).val() == “I need more information”) { $(‘#price_input_div’).hide(); } else { $(‘#price_input_div’).show(); } }); }})(jQuery);

Convert UL to dropdown list not working

@CharlieJustUs when you use Fiddle is automatically sets the $ variable for you. When your script tries to run on your site, that variable is not set, and it fails. Try this please. jQuery(document).ready(function($) { $(function() { $(‘ul.clearfix’).each(function() { var $select = $(‘<select class=”dropdown-toggle” />’); $(this).find(‘a’).each(function() { var $option = $(‘<option />’); $option.attr(‘value’, $(this).attr(‘href’)).html($(this).html()); $select.append($option); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)