That's because your php string contained double quotes, and your javascript string was delimited by ... double quotes. When this happens, you need to escape your php string, like this:
$("#<?php echo $div; ?>").replaceWith("<?php echo addslashes ($testReplace2); ?>")); On Oct 31, 7:03 pm, "Steve Staples" <thestapler...@gmail.com> wrote: > Not really saying it's a problem, but all attributes SHOULD be in double > quotes, and also, the <img> tag, doesn't use the </img> closure, and should > be opened and closed in on statement, like <img /> > > Again, not saying that what you've done is wrong, nor does switching the > single to double, and double to single quotes really make much of a > difference, unless your doctype is strict (I think). > > The Stapler. > > -----Original Message----- > From: webmas...@terradon.nl [mailto:webmas...@terradon.nl] > Sent: Saturday, October 31, 2009 12:09 PM > To: jQuery (English) > Subject: [jQuery] Re: missing ) after argument list SOLVED > > I do not know why, > but using single quotes instead of doubles did solve my problem! > > See the difference: > > $testReplace2 = "<div id='pos1-0'><img name='pos1-0' src='test.gif' > height='50' width='50' border='0' alt='white_pawn'></img></div>"; > > $testReplace2 = '<div id="pos1-0"><img name="pos1-0" src="test.gif" > height="50" width="50" border="0" alt="white_pawn"></img></div>'; > >