http://www.w3.org/TR/html4/struct/global.html#adef-id
HTML standards state that the id attribute should be unique in an html document. Use "class" or somesuch. Then you can do something like.... $(".trContactInfo").hide() and it will hide everything. A. Gundel On Sun, Feb 8, 2009 at 1:30 PM, WebAppDeveloper <minhle0...@yahoo.com> wrote: > > > Hi, > > If I have an html table with 3 rows each with the same id, for example, > id="trContactInfo", as in the html code below. Using jQuery, if I want to > hide these 3 rows with the same id, i would do something like > $("tr#trContactInfo").hide().next().hide().next().hide. My question is: > Instead of running hide() 3 times, is there a way to hide all the rows with > the same id by looping thru all the rows, basically these 3 rows plus any > new rows that may be added to the table with the same id in the future? > > <table> > <tr id="trContactInfo"> > <td>Full Name:</td> > <td><input type="text" name="FullName" size="40"></td> > </tr> > <tr id="trContactInfo"> > <td>E-mail:</td> > <td><input type="text" name="Email" size="40"></td> > </tr> > <tr id="trContactInfo"> > <td>Phone:</td> > <td><input type="text" name="Phone" size="40"></td> > </tr> > <tr> > <td>Field 4:</td> > <td><input type="text" name="Field4" size="40"></td> > </tr> > <tr> > <td>Field 5:</td> > <td><input type="text" name="Field5" size="40"></td> > </tr> > <tr> > <td>Field 6:</td> > <td><input type="text" name="Field6" size="40"></td> > </tr> > </table> > > Thanks very much in advance. > > -- > View this message in context: > http://www.nabble.com/hide%28%29-tp21886844s27240p21886844.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >