Dynamically adding rows to table through jquery -


I'm trying to add new rows to the table when I click on a button. While doing so, my new line is wrapping in the first column of the already existing row

$ ("AddEntry") ("click", function ($ {"(" #momTable "). Endend ('& lt; tr class =" newRow "& gt; & lt; td style =" width: 20px; "& gt; Input & lt; td & gt; 2 & lt; td & gt; Input & lt; td & gt; input type =" text "class =" owner input active "name =" Activity "value =" "& gt; & lt; / td> & lt; td & Gt; & lt; Input type = "text" class = "project name" active "name =" projectname "value =" "& gt; & lt; / td> & lt; td & gt; & lt; input type = "Text" class = "field active input" name = "field" value = "" & gt; & lt; / td & gt; & lt; td & gt; input type = "text" class = "startup input active" Name = "startdate" value = "" & gt; & lt; / td & gt; & lt; Td> & Lt; Input type = "text" class = "targetDateInput active" name = "targetDate" value = "" & gt; & Lt; / Td> & Lt; TD & gt; & Lt; Input type = "text" class = "close" active active "name =" end date "v alue =" "& gt; & Lt; / Td> & Lt; TD & gt; & Lt; Span class = "hide" & gt; Open & lt; / Span & gt; & Lt; Option = "status" category = "showstatus input" & gt; & Lt; Option value = "Open" & gt; Open & lt; / Options & gt; & Lt; Option value = "in progress" & gt; In progress & lt; / Options & gt; & Lt; Option value = "off" & gt; Closed & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Td> & Lt; Td> Textarea rows = "5" cols = "26" class = "commentsInput" name = "comments" text -align = "top" & gt; & Lt; / Text field & gt; & Lt; / TD & gt; & Lt; / TR & gt; '); Console.log (newRow); });

Can anyone please pay attention?

Thank you in advance ...

You are confusing CSS in your code Used under sections

  .newrow {display: none;} #momTable .newrow {display: block; }  

Remove the above CSS and your code will work as it is. Tr & gt; & Lt; Td style = "width: 20px;" & Gt; Edit & lt; / Th & gt; & Lt; Th & gt; SlNo & lt; / Th & gt; ..

The first column starts with the tag td ; th


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -