[HELP JAVASCRIPT] Delete in a table the texts containing a "Yy" prefix
Hello,
Is it possible to help me with a program?
I would like to delete in a table all the texts containing a "Yy" prefix like the words "Yycar", "Yytravel", etc...
I developped a code but it doesn't seem to work at runtime, if you have a track I will be totally grateful to you 🙂
Here is my code:
// recovery. of all <td>
const oCells = document.querySelectorAll("table td");
const search = "Yy";
// the search loop
for (let cell of oCells) {
const text = cell.textContent; // reading raw content
if (text.startsWith(search)) { // occurrence found
cell.textContent = " "; // we replace the content with nothing
}
}This JavaScript code will be used on a PDF document containing a table with data and I would like to delete in this table all the texts containing the prefix "Yy".
Thanks in advance for your reply and have a nice day!
