JQuery - hiding a column table -


As you can see on this jfiddle, I have a simple table here:

 < Code> & lt; Table id = "mytable" & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; Th & gt; Column 1 & lt; / Th & gt; & Lt; Th & gt; Column 2 & lt; / Th & gt; & Lt; Th & gt; Column 3 & lt; / Th & gt; & Lt; Th & gt; Column 4 & lt; / Th & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; Td> & Lt; Input type = "button" name = "mybutton" value = "mybutton" /> gt; & Lt; / Td> & Lt; TD & gt; ... & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; Td> & Lt; Input type = "button" name = "mybutton" value = "mybutton" /> gt; & Lt; / Td> & Lt; TD & gt; ... & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; Td> & Lt; Input type = "button" name = "mybutton" value = "mybutton" /> gt; & Lt; / Td> & Lt; TD & gt; ... & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tdoby & gt; & Lt; / Table & gt;  

Where on the load this code will hide with this code:

  $ ('# mytable tbody tr td: nth-child (3)') . to conceal();  

So I can show it later in execution ... as I've read somewhere this nth-child (n) should do as that column .. Is this not applicable in this case? Could nth-child only work on some of the tables?

two errors in your code

1) You did not include any jquery file 2) Do not close the bracket

  $ (document) .ready (function () {$ ('#mytable tbody tr: nth-child (3) ') Hide ();}); ^^^^ ------- Close the bracket  


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -