Watch full video here -
jQuery provides the global jQuery object (which is present on your page). You can do the following to "get" $ back:
<script > jQuery(function($) {
$("#yourID").html('Text Changed');
});
</script>
But Here you have to need add you jQuery File in your Theme.
and also you have to need jQuery CDN in you wordpress .
Just Copy Past this code -
function add_theme_scripts() {
//wp_enqueue_style( 'style', get_stylesheet_uri() );
//add jquery
cdn
wp_enqueue_script( 'jQuery','https://ajax.googleapis.com/ajax/libs
/jquery/3.6.0/jquery.min.js');
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );
And if you add external javascript or jQuery file then
you can add like this --
function task_enqueue_scripts() {
wp_enqueue_script( 'Your_jsFilename',
get_stylesheet_directory_uri().
'/yourjsfilename.js',
array('jquery'), null, true );
}
add_action( 'wp_enqueue_scripts', 'task_enqueue_scripts' );
If solved your problem then please like and subscribe to my
channel and leave a nice comment here.
0 Comments