i have set a simple JS, just an alert message on click of button with id "button". It is working fine when i insert the code inside Revolution Slider Custom CSS/JS field.
function hello(){
alert("Hello! I am an alert box!!");
}
jQuery("#button").click(hello);
But not working on the function.php file of the child theme, why is that?
function button_fn() {
?>
<script>
function hello(){
alert("Hello! I am an alert box!!");
}
jQuery("#button").click(hello);
</script>
<?php
}
add_action('wp_enqueue_scripts', 'button_fn');