1
0
-1

hi, how to implement javascript in download pdf in datalists?

ive put the javascript in my html in form, but it doesnt seem to work when i use the download pdf.

how?



    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi, If it is possible, can you paste your code here to check for any anomalies?

      thanks

      1. dayana afiqah
        <script>
        function addThousandSeparators() {
            const tables = document.querySelectorAll('table');
            tables.forEach((table) => {
                const precedingH2 = table.previousElementSibling;
                if (!(precedingH2 && precedingH2.tagName === 'H2' && precedingH2.textContent.trim() === 'Company Details')) {
                    const rows = table.rows;
                    for (let i = 0; i < rows.length; i++) {
                        const row = rows[i];
                        const cells = row.cells;
                        for (let j = 0; j < cells.length; j++) {
                            const cell = cells[j];
                            const text = cell.textContent.trim();
                            if (text!== '' &&!isNaN(text)) {
                                const number = parseFloat(text);
                                cell.textContent = number.toLocaleString();
                            }
                        }
                    }
                }
            });
        }
        
        addThousandSeparators();
        </script>


      CommentAdd your comment...