'replace \: in selector for document.querySelector

I use chrome devtools to get the css selector of an element and I get something like this:

"wrap > div.flex-grow.pt-20.md\:pt-4.md"

This string doesn't work in document.querySelector.

How can I edit the string to match the element and be a valid input for document.querySelector?



Solution 1:[1]

use Javascript selector instead. (write "\\:" instead of "\:")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 אוהד באר