I have an XPath /html/body/div[1]/div/div/center[1]/table
and I would like to make it so it is no longer visible.
I saw I could use document.evaluate()
but I am not sure how to hide it.
I have an XPath /html/body/div[1]/div/div/center[1]/table
and I would like to make it so it is no longer visible.
I saw I could use document.evaluate()
but I am not sure how to hide it.
Copyright © 2021 Jogjafile Inc.
If you insist on using XPath, for a single node, use
FIRST_ORDERED_NODE_TYPE
like so:But, XPath selectors are very brittle in userscripts. You're better off using a CSS selector in most cases.
Since the HTML wasn't provided, here is the CSS-selector method shown with a translation of that XPath into a CSS selector:
Of course, it's even simpler with jQuery:
or possibly:
If the node is added via AJAX, use a technique such as in this answer.