D
D
DrunkMaster2018-03-15 17:34:48
JavaScript
DrunkMaster, 2018-03-15 17:34:48

Why does JQ see the element and JS doesn't?

There is this code:

function Set(result) {
    document.getElementByld("block").innerHTML = result;
}

It throws an error: document.getelementbyid is not a function googling, they write that the error occurs when the script is executed when the DOM tree is not yet ready, i.e. there is no such element on the page, but if you put JQ in the same place:
function Set(result) {
    $('#block').html(result);
}

That all works great. Why is that? And how it is necessary to change the first variant that would work there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dom1n1k, 2018-03-15
@DrunkMaster

getElementByld - penultimate letter what?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question