You must Sign In to post a response.
  • Category: JQuery

    Clear and add to a cell using jquery


    In my application iam using an html table for displaying data.

    on the footer of table ,i want to display some data on the cells like this

    var t1 = $('#GridViewProfit th');
    for (var i = 0; i < t1.length - 1; i++) {

    $("#GridViewProfit tr:last td").eq(i + 1).html(listId[i]).css('background-color', 'white');


    here GridViewProfit is the name of html table.

    my requirement is before executing this statement

    $("#GridViewProfit tr:last td").eq(i + 1).html(listId[i]).css('background-color', 'white');

    i want to clear the cell .means erase the previous value

    i have tried these commands

    $("#GridViewProfit tr:last td").eq(i + 1).html("");

    $("#GridViewProfit tr:last td").eq(i + 1).val("");

    but not working .

    how to solve this


  • #761802
    Change this
    for (var i = 0; i < t1.length - 1; i++)

    To this
    for (var i = 0; i < t1.length; i++)

Sign In to post your comments