...

View Full Version : .html() garbles div information



dethfire
12-28-2010, 12:32 AM
It appears that .html() is somehow messing up reading the contents of a div.

Here is my php code which loads into the div.



$own_pre_selection .= "<input name='" . mysql_result($result,$i,"did") . "' value='" . mysql_result($result,$i,"did") . "' type='hidden'><span class='addremove' onclick=\"recordchecks('" . mysql_result($result,$i,"dname") . "','" . mysql_result($result,$i,"did") . "')\";><u>Remove</u></span> &nbsp;" . mysql_result($result,$i,"dname") . "<br>";



Here is what I see as source code after the page renders.



<input name='677' value='677' type='hidden'><span class='addremove' onclick="recordchecks('Heart Neoplasms','677')";><u>Remove</u></span> &nbsp;Heart Neoplasms<br><input name='1298' value='1298' type='hidden'><span class='addremove' onclick="recordchecks('Heart Septal Defects; Atrial','1298')";><u>Remove</u></span> &nbsp;Heart Septal Defects; Atrial<br></div>



When I test alert() the .html() contents it appears like this. It seems to screw up the quote escape and changes \" to " ;="" after the recordchecks().



<input name="677" value="677" type="hidden"><span class="addremove" onclick="recordchecks('Heart Neoplasms','677')" ;=""><u>Remove</u></span> &nbsp;Heart Neoplasms<br><input name="1298" value="1298" type="hidden"><span class="addremove" onclick="recordchecks('Heart Septal Defects; Atrial','1298')" ;=""><u>Remove</u></span> &nbsp;Heart Septal Defects; Atrial<br>



So even though the source code looks perfect, if I alert() the div contents with html() it seems to get a bit garbled in the process. Any ideas?

Old Pedant
12-28-2010, 01:19 AM
But this is bogus:


onclick="recordchecks('Heart Neoplasms','677')";>

The semicolon should either not be there, at all, or should be *INSIDE* the "...".

dethfire
12-28-2010, 04:24 AM
ahhhh haha, thanks :):thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum