0
Good,
I’m doing a database query, where there is a field that has html content. Inside this content is a table, which has some CSS applied inline with a width defined in px.
I need to change the table width property to 100%; The problem is that I am showing this code by php since it comes from the database.
That is, in reality what esotu to do is just this:
echo $dados;
All the html code is within $data. I tried to explain more clearly...
I appreciate the help.
Cumps.
You can use jQuery if the table has some kind of class that you can pick up
– KhaosDoctor
You trigger this "event" as ? the logic is in PHP ?
– Lucas Queiroz Ribeiro
@Khaosdoctor table has no associated class or id and I can’t assign any.
– Luís Almeida
$('table').css('width', '100%');
?– Caio Felipe Pereira
@Lucasqueirozribeiro PHP is only being used to display the comic data.
– Luís Almeida
@Caiofelipepereira remembered this.. but this will change in all existing tables on the right page ?
– Luís Almeida
@Luísalmeida yes. If the table you want is the first, you can do
$('table:first-of-type')
– Caio Felipe Pereira
@Caiofelipepereira Hummm... I’ll try to do it this way.. if it’s the third one I can do $('table:third-of-type') ????????
– Luís Almeida
Your table will probably be printed inside some element that you have a certain identification ? search a table within that particular element:
$( "#minhaDiv" ).find( "table" ).css( "width", "100%" );

– Lucas Queiroz Ribeiro
@Lucasqueirozribeiro good tip... I think I got the solution... thank you.
– Luís Almeida
@Luisa Almeida if it is the third, the selector is
$('table:nth-child(3)')
– Caio Felipe Pereira
The ideal would be for you to edit your question and put the generated HTML so that we have a better idea of how to help you
– Caio Felipe Pereira
With your answer I already managed to modify the width of the table. : ) , I did not put html, because it is very big. But I have already reached the solution. Thank you.
– Luís Almeida
@I will post my suggestion as an answer, if she solved your problem, accepted as an answer. :)
– Lucas Queiroz Ribeiro