javascript in download pdf

Confluence User - 28 Jun, 2024

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?



forms;datalists;userviews

2


28 Jun, 2024
confluenceUser
confluenceUser

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

thanks

02 Jul, 2024
confluenceUser
confluenceUser
<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>


RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print