This is completely intended behavior. You're trying to contact a string 
with an element, forcing the element to use .toString(), which is an Object.

What you can do is change the plus in a comma. Console logs can accept 
multiple arguments;

  console.log("found elem = ", elem);


On Friday, July 25, 2014 10:30:03 AM UTC+2, Ben wrote:
>
> I searched inside a GM script for an element of a web page which contains 
> some text string pattern. 
> If found I want to output it to WebConsole. Therefore I code the following 
> in the GM script: 
>
> var elem = $("h2:contains('dummy')"); 
> console.log("before output"); 
> if (elem) { 
>   console.log("found elem = " + elem); } 
>
> However when I look at the WebConsole then the object content is not 
> displayed. Instead it appears the following: 
>
> "before output" 
> "found elem = [object Object]" 
>
>
> How can I display the content of the found elem in human readable format 
> (=just as the original html code)? 
>
> 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 http://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to