I am kind of new to javascript and trying to accomplish a simple (yet complicated for me) task. I am trying to exclude first row and first column from a table and got stuck in excluding first cell in every row from this table (HTMLTableRowElement). Following is my sample code.
function clickSchedule(){
var table
var grow // group row
table= document.getElementById("myTable");
grow = table.rows;
for(var i= 1; i<= grow.length ; i++ ){
var cellIndex = this.cells;
for( var j =1 ; j<= cellIndex.length ; j++ ){
this.onclick = function () {
alert("test");
}
}
}
The first "for loop" will grab all rows from the table excluding row[0] that is why you can see var i = 1. Next, I am storing cells from all rows to a variable and trying to exclude cell[0] using second "for loop" in order to perform an onclick event to the selected table area.
Also, is it possible to get the index value of the selected cell from this table?
I would really appreciated your help
Faraz Amjad