Uncaught (in promise) TypeError: Cannot read properties of null

I am receiving this error when I try to get a certain element on a webpage with the line of code below. When the website loads, the element is not there yet because you have to click on a link before that element loads. Is there a way to make the call to that line of code retry or wait until you click on the link on the website?

const note = document.querySelector(".btn btn-info btn-note-edit btn-note-save submit note-edit-panel-box")
Was this page helpful?