I have a webpage where you fill a form to generate a work permit on a new page where you can sign it. form page: https://www.sdxworkpermit.se/work-permit/ There are questions as a checklist (only one atm) at the end and I want the function to be if you don't answer the question it wont appear at the next generated page.
I have tried to add javascript to hide the <tr> if the <td> is empty on the e-signature-document page.
I have prefilled document for you to see:
When you answer the question: https://www.sdxworkpermit.se/e-signature-document/?invite=7fe56912485ecd0b40d130ffe47ba380c55c04b2&csum=2d1b0d3b4dd89625958cccb414b5f0f8e87e700d
When you don't answer: https://www.sdxworkpermit.se/e-signature-document/?invite=5d1aee3de1e448064bffb6de58f6fc979c763bec&csum=2c8b2b8fd869f6e8a0fe0d6878d610b67741778c
Javascript (added to plugins page-template: index.php)
<script>
function isEmptyTable(myId){
let tds = document.getElementsByClassName(myId);
let hide = false
for (let element of tds) {
if (element.innerHTML.length == 0) hide = true
}
let myTable = document.getElementById(myId);
if (hide) myTable.style.display = 'none';
}
isEmptyTable("myTable")
</script>
HTML (added to the word press document page)
<table id="myTable">
<tbody>
<tr>
<td>1</td>
<td>[esigcf7 formid="409" field_id="menu-936" ]</td>
</tr>
<tr>
<td>2</td>
<td>[esigcf7 formid="409" field_id="checkbox-138" ]</td>
</tr>
</tbody>
</table>