0

Working code here is mixed with non-working code. The code works up until the line where it commands the innerText to be of

x.innerHTML.substring(3,-3)

This is the function I am calling on a click EventListener for "click". It does go to the function, I do get the console.log appearance. I do not get the change in text from empty to String and nor does it show up in the coded_grove portion of the code.

function makeOverSetup(ev)
{
        document.getElementById("styleVals").value = ev.target.getAttribute("style")
        document.getElementById("thisClasses").value = ev.target.getAttribute("class")
        document.getElementById("thisId").value = ev.target.getAttribute("id")
        document.getElementById("tagName").value = ev.target.tagName
        x = document.createElement("div");
        text = document.createTextNode(ev.target.outerHTML);
        x.appendChild(text);
        x.style.backgroundColor = "blue"
        console.log(x.innerHTML);
        if (document.getElementById("coded_grove").childElementCount.length == 0)
                document.getElementById("coded_grove").appendChild(x.firstChild);
        document.getElementById("coded_grove").firstChild.innerText = (x.innerHTML.substring(3,-3))
        elemCurrentNode = ev.target
        clicked = true
}

This is the site. Thank you in the future.

2
  • 3
    if condition never passes, element.childElementCount is a number, which doesn't have length property. firstChild could be a text node, it doesn't have innerText property.
    – Teemu
    Commented Apr 9, 2023 at 8:07
  • @Teemu I'm making it into a textarea. Its got the best feel to it. I'm very happy now. I've just gotta make it appear now in the screen. I hoping it doesn't take much. Would I be to bold as to change the code? Commented Apr 9, 2023 at 8:21

0

Browse other questions tagged or ask your own question.