Sunday, May 20, 2018

How To Delete the text box using the JavaScript Dynamically

Leave a Comment

Delete the text box using the JavaScript Dynamically 




This topic is to delete the textbox/textarea/selectbox which will be created dynamically in the application using java script.

If you need to delete the rows just u need to select that check box and go for the delete button .

You can have this code for using in your application this must be related to the button which you will use in your application the Code is:



JavaScript Code Example

function deleteRow() {
 try {
  var table = document.getElementById(myTable);
  //alert(’table’+table);
  var rowCount = table.rows.length;

  for (var i = 0; i < rowCount; i++) {
   var row = table.rows[i];
   var chkbox = row.cells[0].childNodes[0];
   if (null != chkbox && false == chkbox.checked) {
    table.deleteRow(i);
    rowCount;
    i;
   }

  }
 } catch (e) {
  alert(e);
 }
}

HTML Code for Web Page


<INPUT type="button" value="Delete Row" onclick="deleteRow()" />
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment