Is it possible to use querySelector() on a dynamically created element?


I'm using appendHtml() in a loop to dynamically add li elements (with unique IDs in the string) to a ul. When I need to access these dynamically created li elements by their IDs to, for example, create nested lists, querySelector() returns null. If I should be able to do this, then there could very well be bugs in my code. But I want to make sure this is the case.


It doesn't matter how elements are added, if the are part of the DOM querySelector can find them.


  • Modify a Google App Engine entity id?
  • Slowly changing dimension - What is Pure type 6 implementation
  • SQL append distinct values from two columns and two tables
  • Hibernate: Inheritance and relationship mapping + generics
  • How can I see a list of all files that are different between two Hg repositories?
  • Should I use composite primary keys in Grails?
  • Receiver has no segue with identifier“***”
  • In loopback documentation what does variable 'cb' stands for?
  • Updating Dojo provide
  • List images(01.png) and descriptions(01.txt) from directory
  • calculate gradient output for Theta update rule
  • Conversion from string “a” to type 'Boolean' is not valid
  • Not able to aggregate on nested fields in elasticsearch
  • Marklogic : Query response time is very high
  • Mysterious problem with floating point in LISP - time axis generation
  • How to know when stdin is empty if it contains EOF?
  • How to use an array of arrays with array_map(…) in PHP?
  • Initializer list vs. initialization method
  • Using jQuery closest() method with class selector
  • Nant, Vault & Windows Integrated Authentication
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • Incrementing object id automatically JS constructor (static method and variable)
  • Weird JavaScript statement, what does it mean?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Jquery - Jquery Wysiwyg return html as a string
  • Apache 2.4 - remove | delete | uninstall
  • AT Commands to Send SMS not working in Windows 8.1
  • Comma separated Values
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Benchmarking RAM performance - UWP and C#
  • Error creating VM instance in Google Compute Engine
  • Free memory of cv::Mat loaded using FileStorage API
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • apache spark aggregate function using min value
  • unknown Exception android
  • Sorting a 2D array using the second column C++
  • Reading document lines to the user (python)
  • Observable and ngFor in Angular 2