'I'm having trouble understanding how to get JavaScript to function as a program

This is going to sound really, really basic, but I just need a little help understanding one of the concepts I'm struggling with in Javascript. I have been reading tutorials on loops, if/elseif/else and so on, I have a fairly decent understanding of them and how they work, but it's implementing and using them I am really confused about.

Just to be clear, I understand how to link my script.js file to my index.html. What I am having trouble understanding is how the Javascript I write, is influenced and connected to the HTML/CSS I write.

For example, if building a quiz, if I write a Submit button in HTML, how do I link my Javascript to that button, how does my Javascript know what I want to do with that button, and how does that button (submitting an answer > calculating how many correct answers I have submitted) connect to the rest of my Javascript input (listing questions, calculating how many correct answers I have, submitting them)?

Is there a particular name for the topic that covers this and will help me learn to understand it?



Solution 1:[1]

You should learn about javascript events, There is a sample example of how it works for connect HTML button by javascript

Javascript events example

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Abdelrazek Ali