I need to use:
var obj=document.getElementsByClassName[n];
setInterval("somefunc("+obj+");",10);
When I’m trying to run this code, I get “Uncaught SyntaxError: Unexpected identifier”. I know about this problem with setTimeout("alert("+str+");), when I should use .toString(), but what if I need to pass an object in function?
Thank you.
Yes you can but like this:
So here is how your code should be:
You had these problems with your previous code:
someFun(obj)eval()function behind the scenes by wrapping your code in quotes.