how to give css style in javascript
// Bad:
element.setAttribute("style", "background-color: red;");
// Good:
element.style.backgroundColor = "red";
document.getElementById("myH1").style.color = "red";
Also in JavaScript:
- state in react
- async for loop
- js combine two arrays
- laravel fetch post
- js make radio checked
- useeffect react
- How to create HTML forms and attach JavaScript behaviors ALL TYPES
- create multidimensional array javascript for loop
- angular material open last visited tab
- React looping hooks to display in other hook
- Vue is not defined
- check if string only contains integer digits numbers javascript
- javascript loop through array backwords
- Iterate with JavaScript For Loops
- transform array to string js
- setAttribute()
- parseint function javascript
- js remove space from string
- js last array element
- react select options
- code to launch browser using javascript
- jquery data attribute
- javascript write to file
- disable input jquery