Note that there are some explanatory texts on larger screens.

plurals
  1. POAction not triggered with checkbox created dynamically
    primarykey
    data
    text
    <p>When I created a checkbox with HTML the action is triggered normal but the problem when I create the checkbox with javascript(when I add a row in my table with button and I click to the new checkbox) action does not work.</p> <p>This is my code : </p> <pre><code>&lt;HTML&gt; &lt;HEAD&gt; &lt;SCRIPT type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"&gt;&lt;/script&gt; &lt;SCRIPT&gt; $(window).load(function() { $('input[name=chk]').change(function() { if ($('input[name=chk]').is(':checked')) { alert("checked"); } else { alert("unchecked"); } }); }); function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; element1.setAttribute("name","chk"); cell1.appendChild(element1); var cell2 = row.insertCell(1); cell2.innerHTML = rowCount + 1; var cell3 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "text"; cell3.appendChild(element2); } &lt;/SCRIPT&gt; &lt;/HEAD&gt; &lt;BODY&gt; &lt;INPUT type="button" value="Add Row" onclick="addRow('dataTable')" /&gt; &lt;TABLE id="dataTable" width="350px" border="1"&gt; &lt;TR&gt; &lt;TD&gt;&lt;INPUT type="checkbox" name="chk"/&gt;&lt;/TD&gt; &lt;TD&gt; 1 &lt;/TD&gt; &lt;TD&gt; &lt;INPUT type="text" /&gt; &lt;/TD&gt; &lt;/TR&gt; &lt;/TABLE&gt; &lt;/BODY&gt; &lt;/HTML&gt; </code></pre> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload