views:

49

answers:

2

I can't believe it, but this is really happening. I ran out of available quote symbols using jquery and javascript native functions together. Can somebody help? Maybe there is yet another symbol?

var t=setTimeout('$("#popupChange").html('<img src="http://servername/pdf/picture/genericThrobber.gif" />');',2000);

EDIT: Firebug messages about "missing ) after argument list" error.

+5  A: 

Escaping them using \' should work.

var t=setTimeout('$("#popupChange")
.html(\'<img src="http://servername/pdf/picture/genericThrobber.gif" />\');',
2000);

(added line breaks to get rid of the scroll bar)

you could also pass an anonymous function instead of a string:

var t=setTimeout(function() { $("#popupChange")
.html('<img src="http://servername/pdf/picture/genericThrobber.gif" />');},
2000); 

should be fine either way.

Pekka
+2  A: 

You need to escape the characters using a backslash.

On the inner ', make it \'

Kerry