User Interaction
One of the simplest ways to add ui into your website is with the alert methods. These are the pop-ups that appear in the browser. These include: alert, confirm and prompt. Alert just sends an alert, without any confirmation. Confirm asks a yes no question, and returns a boolean value. Prompt allows you to input text/numbers/
Other methods
The more commonly used method to get data is with buttons and html forms. This page won't tell you anything about forms, but will show functions and buttons. Buttons can have an onClick property, that can be used to activate a javascript function.
HTML:
`button onClick='myFunction' id="btn"> A button `/button>
JS:
function myFunction(){
document.getElementById('btn').style.backgroundColor = 'red'
`button onClick='myFunction' id="btn"> A button `/button>
JS:
document.getElementById('btn').style.backgroundColor = 'red'
Learn about html forms and other input types here