Skip to content
Advertisement

Can someone tell me why this doesn’t work? (javascript html node selector)

This query selector doesn’t work on this HTML. It works in CSS. Can anyone tell me the correct solution?

Basically, I am using an older version of the material table and want to hide the “Export as PDF” option. I know the newer version allows it in exportButton option.

JavaScript
JavaScript

Advertisement

Answer

You need JQuery to use the :contains() Selector

JavaScript

Also there is no CSS selector targeting on textContent. Take a look at full list of CSS3 Selectors

We need another method here :

JavaScript

Now you have the correct element.

To hide an object you should NOT remove that ! You can simply change display property of element :

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