Cómo ocultar un elemento td usando el uso de classname

    <table>
      <tbody>
        <tr>
         <td class="A">More Html element</td>
         <td class="B">More html element</td>
        </tr>
       <tr>
         <td class="A">More Html element</td>
         <td class="B">More html element</td>.....(2)
      </tr>
      <tbody>
   <table>

How using jquery I can hide the element at number 2?

preguntado el 08 de noviembre de 11 a las 12:11

3 Respuestas

You can allso use selector de nth-child , Me gusta esto $('td.B:nth-child(2)').hide();, but i don't realy recomend hiding td elements as you're table might go "wild" in some cases , you should hide the content of the td element ( <td class="B"><span class="hideMe">sadsa</span></td> , so you're jquery selector for hiding would look like $('td.B:nth-child(2) .hideMe').hide();

respondido 08 nov., 11:16

$("TABLE TD.b").eq(1).hide();

Note though, that this may cause layout issues with cells moving accross your table. A better solution would be to have a container div inside the cell and hide that instead.

respondido 08 nov., 11:16

Ejemplo

$('td.B').eq(1).hide();

Utiliza eq to select the specified index.

Demo

respondido 08 nov., 11:17

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.