Jquery Problem

hello!!

I’ve been trying to add Jquery Code in a page from a website but it dosn’t apply the code… i mean it says is loaded but don’t work.

please help!!

Hey there,
I hope you’re doing well today

Could you provide me with some more information.
For example, how are you trying to add the JS code to the page?

Also In order to add JS to a particular page, try using the following plugin: Simple Custom CSS and JS – WordPress plugin | WordPress.org

Best Regards,
Support

Hi!

Well i tried with this on functions.php of illdy:

add_action( ‘wp_enqueue_scripts’, ‘add_my_script’ );
function add_my_script() {
wp_enqueue_script(
‘cursos’,
get_template_directory_uri() . ‘layout/js/cursos.js’,
array(‘jquery’)
);
}
and my js code is:

$(document).ready(function(){
$("#p1").click(function(){
$("#t1").css(“display”, “block”);
$("#r2,#r3,#r4,#r5,#r6").each(function(){
$(this).css(“display”,“none”);
});
});
});

also tried with this on illdy child:
function my_custom_scripts() {
wp_enqueue_script( ‘cursos’, get_stylesheet_directory_uri() . ‘/js/cursos.js’, array( ‘jquery’ ) );
}
add_action(‘wp_enqueue_scripts’, ‘my_custom_scripts’);
?>

help!!

Hello there,

Have you tried adding the code using the plugin that was provided earlier?

Best Regards,
Support

yes i tried 2 times with the plugin but it didn’t work… right now i just tried again and work… don’t know… thanks anyways. if you can provide me information about how to add .js files and load would be great… but now it is soolved… thank you so mucho! you guys are the best