Answer the question
In order to leave comments, you need to log in
I can't see the jquery function in wordpress, what should I do?
My code does not see jquery in wordpress,
I looked on the sites for how to connect,
connected,
develope elements shows in the head a bunch of links to something there and to jquery, so it connected?
my js file inserted after jquery
but in console Uncaught TypeError: $ is not a function
wordpress theme own
js code
$(document).ready(function() {
alert("fdgsdh")
}
)
<?php
function jquery_init() {
wp_enqueue_script("jquery");
wp_enqueue_script('newscript', get_template_directory_uri() . '/jj.js');
}
if(!is_admin()){
add_action('wp_enqueue_scripts', 'jquery_init');
}
?>
Answer the question
In order to leave comments, you need to log in
Because WordPress uses jQuery instead of $. You just need to replace, this is the easiest solution
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question