How can I locate the correct element using querySelector

In chrome console, i am able to inject a js like below

$("#pageForm").window('open');

And then the DIV form will pop up, however, if i change it to below

document.querySelector("div#pageForm").window('open');

It will return error: Uncaught TypeError: document.querySelector(…).window is not a function at :1:41

Am I doing wrong in locating an element ? Thanks

Answer

You could simply wrap the queryselctor with $

$(document.querySelector("div#pageForm")).window('open');

Leave a Reply

Your email address will not be published. Required fields are marked *