I am trying to create a row of a table on the check action of a checkbox which is created dynamically. The flow is not entering the function on the check event.
addCheckboxItems : function(form){
var newBox = ('<input type="checkbox" name="checkBoxItem" onCheck="JavaScript:addRowItems(this)"; id="checkBoxItemId" value="' + form.combobox.value +'"'+ '>'+form.combobox.value);
document.getElementById("divCheckbox").innerHTML = newBox;
}
addRowItems : function(element){
alert('Hi');
if(document.getElementById("checkBoxItemId").checked){
var tableRef = document.getElementById('tbl').getElementsByTagName('tbody')[0];
var newRow = tableRef.insertRow(tableRef.rows.length);
var td1 = document.createElement("td")
var strHtml1 = document.getElementById('checkBoxItemId').value;
td1.innerHTML = strHtml1.replace(/!count!/g,count);
var td2 = document.createElement("td")
var strHtml2 = "NA";
td2.innerHTML = strHtml2.replace(/!count!/g,count);
var td3 = document.createElement("td")
var strHtml3 = "<a>Remove</a>";
td3.innerHTML = strHtml3.replace(/!count!/g,count);
newRow.appendChild(td1);
newRow.appendChild(td2);
newRow.appendChild(td3);
tableRef.appendChild(newRow);
}
}
How can I achieve this.....Thanks in advance..