How can I locate the correct element using querySelector Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How can I locate the correct element using querySelector without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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');
We are here to answer your question about How can I locate the correct element using querySelector - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji