0
Can anyone explain me how to put js in web.
I dont know how to conect js with html and css.
6 Answers
+ 1
There is two way to add JS in the web:
1. Internal
2. External
1. Internal:-
In this, the JavaScript can be put into the script tag.
Example:
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
2. External:-
In this, create the separate JavaScript file then link that file in the html.
Example:
Let we have the file "hello.js"
Now link this into the html
<html>
<body>
<script src="hello.js"></script>
</body>
</html>
+ 1
in SoloLearn create a new web code
and everything is set up. there will be a tab for html, css, and js. write your html in html and javascript in js you don't have to add javascript inside html tab. unless you need something like jquery or p5js...
+ 1
by using their id or class.
if you have a button i. e
<button id ="ok" > </button>
in js write :
var btn = document.getElementById("ok")
have you learned anything about javascript?
0
I wont to use it in sololearn
0
But how to conect buttons and forms to js