jquery - how to make columns except first in each row to be align left? -
I want to create all the columns except the first row in the table After clicking on the button, only the first row gets the effect, all the columns in the other rows are all Your current jQuery code will receive all this. .. More people Da is better if you can just use css .... text-align: left , first Column
text-aligned is defined in
css . Here's the code:
& lt; Script type = "text / javascript" src = "../ss / jquery-1.9.1.min.js" & gt; & Lt; / Script & gt; & Lt; Style type = "text / css" & gt; Table {boundary: 1px solid red; Degradation: collapse; } Table TD {boundary: 1 px solid red; Text align: center; } & Lt; / Style & gt; & Lt; Script type = "text / javascript" & gt; $ (Function () {$ ("input [type = 'button']"). ("Click", function () {$ ("# table tr td: gt (0)") .css ({" Text-to-curry "});});}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Input type = "button" value = "click" /> & Lt; Table id = "table" & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; TD width = "150px" & gt; Center & lt; / TD & gt; & Lt; TD width = "150" & gt; Left & lt; / TD & gt; & Lt; TD width = "150" & gt; Left & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Center & lt; / TD & gt; & Lt; TD & gt; Left & lt; / TD & gt; & Lt; TD & gt; Left & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Center & lt; / TD & gt; & Lt; TD & gt; Left & lt; / TD & gt; & Lt; TD & gt; Left & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Body & gt;
text-left , which includes the first column is not . So why? Should I want to repeat elements with
TR
each method?
TD and then into the archive First of all ... you get the code of
$ (function () is in place of your code with $ ("input" [type = 'button'] "). (" Click ", function ( } {$ ("# Table tr td") No. (': first-child'). CSS ({"text-align": "left"});});});
table td {border: 1px solid red; text align: left;} table td: first-child {text- Align: center;}
Comments
Post a Comment