You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility
When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!
JS is about behaviors that cannot be replicated using CSS. For instance, CSS cannot validate a web form. For that we need script that can target a form control and examine the user input for that control. It can manipulate the DOM to display error messages to the user and disable the SUBMIT button until such repairs are made.
We can use JS to suppress and display any part of a web page in response to a users interaction. That is why we say that JS adds interactivity to an otherwise static document, keeping in mind that CSS offers some of the same, with limitations that need to be learned.
Today’s web is anything but static. A web page without interactivity is rather a rare thing, these days. JS helps to gather information about the user agent and tailor responses to that UI. It can help to make decisions about which response to give to which user inputs or interaction.
Script can be used to write and modify a style sheet, write and modify page text, write and modify cookies, write and obfuscate email addresses so spam bots can’t find them, but the user can. We haven’t really put more than scratch up to this point of the complete range of script possibilities. The bottom line is scripting has and always will be how we give our pages and apps their horse-power and versatility.