I'm working on a Rails 6 app and I'm trying to put some Javascript functionality into my app. The code I'm using is working on non Rails template but when I put the same code into Rails 6 app application.js folder the Javascript function is not working.
application.js
function hideButtin(){
var element = document.getElementById("hide");
element.style.display = 'none';
}
header.html.erb
<%= link_to "OWNER SIGN UP", signup_path, class: "button", onclick: "hideButtin()" %>
_form.html.erb
<div id="hide">
<%= f.check_box :owner %>
<%= f.label :owner %>
</div>