Skip to content
Advertisement

How to get element without ID or Class Name using Javascript DOM

I’m developing a chrome extension for manipulating HTML elements. I got a little problem. The element that I want to manipulate is without ID or ClassName, like this:

JavaScript

I want to manipulate the width. But there is no identifier in the tag div. How can I manipulate that tag using javascript DOM?

Advertisement

Answer

You can use querySelector.

Here is a simple example:

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement