Testing of Jquery :: How to check that jquery is added in the rails application or not

Reference Link :: https://www.geeksforgeeks.org/how-to-set-alert-message-on-button-click-in-jquery/


Note :: We set the alert message for checking the jquery is working or not 


Note :: Add the below code inside ruby on rails application inside 

index.html.erb

if the button is work then the jquery is work otherwise not 


<!DOCTYPE html>

<html lang="en">


<head>

<script src=

"https://code.jquery.com/jquery-3.6.0.min.js"

integrity=

"sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="

crossorigin="anonymous">

</script>

</head>


<body>

<button id="btn">Click me!</button>


<script>

$(document).ready(function () {

$("#btn").click(function () {

alert("This is an alert message!");

});

});

</script>

</body>


</html>






Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5