Why can't html input functions be in JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why can't html input functions be in JavaScript

since JavaScript is embedded in HTML why can't their functions be used interchangeably

29th Dec 2017, 11:07 PM
Toluwase Shoniran
1 Answer
+ 5
Not sure I understand you question, can you provide an example please. JavaScript can either be embeded in your HTML or in a separate .js file and just reference that file within your HTML. You write function in JavaScript to interact with your HTML (eg modify, add, remove elements). HTML can only call your JavaScript functions.
30th Dec 2017, 12:43 AM
Duncan
Duncan - avatar