Wordpress core jQuery conflict

admin

Administrator
Staff member
Code:
function my_customize_scripts(){
wp_register_script('my-customizer-js', get_template_directory_uri() .'/js/customizer.js', array('jquery'), 1.0, true);
wp_enqueue_script('my-customizer-js');
}add_action('customize_controls_enqueue_scripts', 'my_customize_scripts', 1);

jQuery file enqueue with hook
Code:
customize_controls_enqueue_scripts
works only when page starts to load, but when loaded it's just stop working. And worse, all the
Code:
.change()
functions' execution result desapears. It worked fine before, and three days earlier just stop working.
This file,
Code:
customizer.js
has to enqueue with this hook
Code:
customize_controls_enqueue_scripts
, it will not work in customizer other wise. Well, at least as I know, cause I tried all other hooks.

This is how jQuery code wrapped in
Code:
customizer.js

Code:
jQuery(document).ready(function($){
//code here
}

inside has
Code:
change()
functions for elements depends on input.

I tried to
Code:
wp_derejister_script('jquery');
to dequeue the wordpress core jQuery and then add hardcoded Google api just before
Code:
wp_head
in my
Code:
header.php
, like

Code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

and it worked, but it's not an option. I want the Wordpress core jQuery run on my website.
I tried to undo all the changes that I've done to
Code:
customizer.js
when it stopped working. Also I tried to reduce this file, and took off all events, except one. It didn't help either.
But the
Code:
alert();
that I put inside function is working just fine BTW.

So please, any help is appreciated.

P.S. I checked other js files, as I can see they work fine. I also tried to enqueue customizer.js the general way
Code:
wp_enqueue_script()
guess what, you right - it didn't work.
This is my first time I am asking question here, this is my last hope.