table - Jquery fails to dynamically create a row cross browser -
I have this function for my comment system but it does not dynamically add row ... this is what Looks like:
var myTable = $ ("# adddatacom" + id); Var Magic Newwe = Document. CreateElement ('tr'); MagicNewRow.htmlContent = '& lt; Td class = "comment" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; TD width = "600px" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt ;? Php echo $ userimg2; ? & Gt; & Lt; / Td> & Lt; Td> & Lt; B & gt; & Lt; A href = "profile.php" & gt; You can & lt; / A & gt ;, & lt; / B & gt; & Lt; B style = "color: green" & gt; Just now & lt; / B & gt; & Lt; Br> '+ ComMessage.val () +' & lt; / Td> & Lt; / Tr & gt; & Lt; / Table & gt; & Lt; / Td> '; MagicNewRow.innerHTML = '& lt; Td class = "comment" id = "newcomm" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; TD width = "600px" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt ;? Php echo $ userimg2; ? & Gt; & Lt; / Td> & Lt; Td> & Lt; B & gt; & Lt; A href = "profile.php" & gt; You can & lt; / A & gt ;, & lt; / B & gt; & Lt; B style = "color: green" & gt; Just now & lt; / B & gt; & Lt; Br> '+ ComMessage.val () +' & lt; / Td> & Lt; / Tr & gt; & Lt; / Table & gt; & Lt; / Td> '; MyTable.append (magicNewRow);
Your syntax appears to be correct
Var myTable = $ ("#adDatacom" + ID); Var Magic Newwe = Document. CreateElement ('tr'); MyTable.html ('& lt; td class = "comment" & gt; & lt; table & gt; & lt; tr & gt; td width = "600px"> gt; table & gt; & lt; td & lt; p & gt; & lt; ; A href = "profile.php" & gt; You should & lt; / a & gt; & lt; / p & gt; & lt; p style = "color: green" & gt; now & lt; / b & Lt; br & gt; '+ comMessage.val () +' & lt; / td> & lt; / tr & gt; & lt; / table & gt; & lt; / td & gt; ; ';); MagicNewRowhtml ('& lt; td class = "comment" id = "newcomm"> gt; & gt; table & gt; & lt; tr & gt; td width = "600px" & gt; & lt; table & Gt; & lt; TR & gt; & lt; TD & gt; & lt;? Php echo $ userimg2 ;? & gt; & lt; / td> & lt; td & gt; & lt; p & Gt; & lt; a href = "profile.php" & gt; You should & lt; / a & gt; & lt; / p & gt; & lt; p style = "color: green" & gt; & Lt; / b & gt; & lt; br & gt; '+ comMessage.val () +' & lt; / tr & gt; & lt; / table & gt; & lt ; / Td> '); MyTable.append (magicNewRow); . $ ('# Someelement') attached (mytable);
Comments
Post a Comment