Put a cell in red from a td with a dynamically created class?

0

I am creating the body of a table dynamically by jquery, in the td I assign the red class to put the color of the cell in red

in the css I apply:

.rojo{
    border-width: 1px;
   border-color:red;
 }


function imprimirDatos(div, item) {
   var cadena = "<tr class='columna'>";
   cadena = "<td class='rojo'> <input class='ciudad' value='" + item.ciudad + "'>"
   cadena = "<td> <input class='año' value='" + item.año + "'></td> "
   div.append(cadena);
 }

The edge of the cell does not change color, I do not know if it is because it is being created dynamically or by bootstrap but I apply it important and it does not paint it either.

Edition

I do not have more in the css. I think the problem may be in the bootstrap

    
asked by Acd 17.06.2017 в 00:19
source

1 answer

1

you're missing border-style :

border-style:solid;

try with

border: 1px solid red;

I do not see where you close td in

"<td class='rojo'> <input class='ciudad' value='" + item.ciudad + "'>"

should be

"<td class='rojo'> <input class='ciudad' value='" + item.ciudad + "'></td>"

I do not see where you close tr

.rojo{
    border-width: 1px;
   border-color:red;

 }

.rojo2{
    border: 1px solid red;
 }
 
 .rojo3{
  border-width: 1px;
   border-color:red;
    border-style:solid;
 }
<table>
<tr>
<td class='rojo'> <input class='ciudad' value='" + item.ciudad + "'></td>
<td class='rojo2'> <input class='ciudad' value='" + item.ciudad + "'></td>
<td class='rojo3'> <input class='ciudad' value='" + item.ciudad + "'></td>
</tr>
</table>
    
answered by 17.06.2017 / 00:59
source