Skip to main content
Kishore Talari (Cognizant) a posé une question dans #Visualforce
I want to display check box with records in html table 

Thanks,

Kishore
2 réponses
  1. 22 oct. 2018, 04:55
    Hi Krishna,

    Please find the sample code below and tweak it as per your requirement.

    HTML:

    <table>

    <thead>

    <tr><th></th><th>Row Text</th></tr>

    </thead>

    <tr>

    <td><input type="checkbox" /></td>

    <td>Test</td>

    </tr>

    <tr>

    <td><input type="checkbox" /></td>

    <td>Test 2</td>

    </tr>

    <tr>

    <td><input type="checkbox" /></td>

    <td>Test 3</td>

    </tr>

    </table>

    Javascript:

    checkboxes = document.getElementsByTagName("input");

    for (var i = 0; i < checkboxes.length; i++) {

    var checkbox = checkboxes[i];

    checkbox.onclick = function() {

    var currentRow = this.parentNode.parentNode;

    var secondColumn = currentRow.getElementsByTagName("td")[1];

    alert("My text is: " + secondColumn.textContent );

    };

    }

    For more information please refer to below link which might help you further.

    Please mark this as solved if the reply was helpful.

    Thanks,

    Nagendra