DIV with two tags?

I know how to deal with more than one class in div but I never seen something like that:

<div data-reactroot>
</div>

It is not a class, not a ID it looks just like multiple tag. How am I supposed to select it with jQuery? I tried

$('div data-reactroot');

But it seems that I'm not even close to it.

Upvotes: 1

Views: 363

Answers (2)

Asons
Asons

Reputation: 87262

As written, it is an attribute and here is how to get it with plain javascript using the querySelector

var elem = document.querySelector('div[data-reactroot]');    

Upvotes: 2

Rajaprabhu Aravindasamy
Rajaprabhu Aravindasamy

Reputation: 67217

Try to use has attribute selector at this contex,

$('div[data-reactroot]');

Since data-reactroot is an attribute of div element.

Upvotes: 8

Related Questions