Why does jQuery or a DOM method such as getElementById not find the element?
问题 What are the possible reasons for document.getElementById , $("#id") or any other DOM method / jQuery selector not finding the elements? Example problems include: jQuery silently failing to bind an event handler jQuery "getter" methods ( .val() , .html() , .text() ) returning undefined A standard DOM method returning null resulting in any of several errors: Uncaught TypeError: Cannot set property '...' of null Uncaught TypeError: Cannot read property '...' of null The most common forms are: