I am having trouble creating a button with a link embedded in it. Can anyone provide assistance?
Here is the code I have been using: var btn = document.createElement("button");btn.innerText="new button";document.body.appendChild(btn);
I also attempted to create a div and add an href attribute to it, but that method was unsuccessful.
var dv = document.createElement("div");dv.innerHTML = " " dv.style.color = 'red';dv.setAttribute('href', 'www.google.com'); document.body.appendChild(dv);