-3
I have the following code:
var cont1 = $('.stat_col:contains("Total de páginas impressas")').next();
var cont2 = $('.stat_col:contains("Total de páginas impressas em preto e branco")').next();
var cont3 = $('.stat_col:contains("Total de páginas coloridas impressas")').next();
var cont4 = $('.stat_col:contains("Total de páginas impressas de um só lado")').next();
var cont5 = $('.stat_col:contains("Total de páginas impressas de ambos os lados")').next();
var cont6 = $('.stat_col:contains("Total de atolamentos")').next();
var cont7 = $('.stat_col:contains("Total de separações perdidas")').next();
var cont8 = $('.stat_col:contains("Total de páginas digitalizadas do ADF")').next();
var cont9 = $('.stat_col:contains("Total de páginas digitalizadas de ambos os lados")').next();
var cont10 = $('.stat_col:contains("Total de páginas do vidro do scanner")').next();
var cont11 = $('.stat_col:contains("Total de atolamentos")').next();
var cont12 = $('.stat_col:contains("Total de separações perdidas")').next();
var cont13 = $('.stat_col:contains("Total de cópias")').next();
var cont14 = $('.stat_col:contains("Total de cópias em preto e branco")').next();
$(cont1).append($(" - " + cont1).html());
For example the HTML content of the line that cont1
search is:
<tr class="gui-list-tbl-even-row"><td class="stat_col">Total de páginas impressas</td><td class="addrTemp_col">5382</td></tr>
The problem that for example everything you have in 'cont1', also has in 'cont2', 4 and 5.
In addition to capturing each 'counter', I need to be able to inject (dynamic) information in each of them based on the corresponding value of each line.
hkotsubo in both jQuery and no jQuery cases the result on the console comes Ok, but in the already error append because the variable is an object (Uncaught Error: Syntax error, unrecognized Expression: - [Object Htmltablecellelement]), and I will need to insert information on each line.
– Daniel Plácido
@Danielplácido In the above examples I get the text from each cell (using
text()
jQuery orinnerText
in pure JS. If that’s not what you need, just edit the question and add more details.– hkotsubo