Lovely!
as you use mouseover and mouseout, there is no need to use a class. You are able to apply the attributes directly to the DOM elements:
<script> function Menu(list) { let menu = ul(list, "border: 2px solid pink; width: 200px; margin: 5px; padding: 0; list-style-type: none;"); for (let el of menu.childNodes) { el.onmouseover = (e) => {setAttributes(e.srcElement, "background: deeppink;color: white;cursor: pointer;") }; el.onmouseout = (e) => { setAttributes(e.srcElement, "background: white;color: black;cursor: pointer;") }; } return menu; } h1("DML & Bss (css in JS)", "text-align:center") Menu(["item1", "item2", "item3"]) Menu(["item11", "item22", "item33", "item44"]) </script>
Ok, thank you Eckehard :-)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Lovely!
as you use mouseover and mouseout, there is no need to use a class. You are able to apply the attributes directly to the DOM elements:
Ok, thank you Eckehard :-)