Skip to main content

JavaScript

How to add your own JavaScript to pages.

You can use JavaScript to make changes to a web page without loading a new one. For example, a user could enter some numbers, then JavaScript displays the results of a calculation without loading a new page.

Add your JavaScript to the file at app/assets/javascript/main.js.

Do not edit the file at public/assets/javascript/main.js because it’s deleted and rebuilt every time you make a change to your prototype.