Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML DOM TableRow deleteCell() Method

  • Last Updated : 31 Aug, 2021

The TableRow deleteCell() Method in HTML DOM is used to delete a cell from a current row in a Table. It is a predefined method of the TableRow Object. 



Property Values:

  • index: It contains a numeric value that starts from 0 which defines the position of the cell to be deleted from the current row. For example- The value 0th indicates the first positioned cell to be deleted. The value -1th represent that delete the last positioned cell. 



  • The parameter is to be defined mandatory in the Firefox and Opera browser. On the other hand, it is optional in safari, chrome and IE Browsers.
  • If this parameter is not contain any value, it  deleteCell() delete the last cell in IE and the first cell in Chrome and Safari.

Example: In this example, we will delete the first and cell from the current row. 


<!DOCTYPE html>
        HTML DOM TableRow deleteCell() Method
        td {
            border: 1px solid green;
        h1 {
            color: green;
        h2 {
            font-family: Impact;
        body {
            text-align: center;
        HTML DOM TableRow deleteCell() Method
    <table align="center">
        <tr id="gfg">
    <button onclick="firstCell()">
        Delete the First Cell
    <button onclick="lastCell()">
        Delete the Last Cell
        function firstCell() {
            var Cell =
        function lastCell() {
            var MyCell = document.getElementById("gfg");


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!