I'd just use XPath.
On 2/7/2016 2:20 PM, 'Ben Stover' via greasemonkey-users wrote:
Assume I want to get the content of the following (inner) element and put it at
another position:
<aside id="parent">
<p class=" aaa bbb ccc"> ...... </p>
</aside>
then the following code (in an GM script) does not work:
var pane = document.getElementsByClass("aaa bbb ccc")[0];
var target = document.getElementsByClass("foobar")[0];
target = pane.innerHTML;
The following does not work as well:
var pane = document.getElementsByClass("aaa.bbb.ccc")[0];
var target = document.getElementsByClass("foobar")[0];
target = pane.innerHTML;
So how else should I code this?
Does it matter that I hide the original element with
GM_addStyle("#parent { display: none !important; }");
Thank you
Ben
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.