Answers for "? created when button clicked"

2

javascript inline onclick get event

<div onclick="doSomething(event,this)"></div>
<script>
     function doSomething(e,el){
         e = e || window.event;
         console.log(e); //will be the event
         console.log(el); //we be the dom element 
     }
</script>
Posted by: Guest on November-30-2020
0

how to create button on button click

-------------------------------------------
||| Put it All in a Function Css DOM JS |||
-------------------------------------------

var btn = document.createElement("a");
btn.innerHTML = "Get Account";
btn.style.Color = "blue";
btn.style.padding = "15px 20px";
btn.style.border = "1px solid #ffffff";
btn.style.backgroundColor = "#307cee";
btn.style.borderRadius = "30px";
btn.href = "http://example.com";
btn.style.textDecoration = "none";
btn.style.display = "inline - block";
btn.style.innerHTML = "Underline Removed";
document.body.appendChild(btn);
Posted by: Guest on December-01-2020

Code answers related to "? created when button clicked"

Browse Popular Code Answers by Language