开发者

Fetch a particular content from a row using jquery

开发者 https://www.devze.com 2023-03-31 11:58 出处:网络
how can a fetch a particular content from a row in w开发者_运维百科hich the row contents product name,barcode,quantity and buy price.I am to delete the particular row by using this jquery

how can a fetch a particular content from a row in w开发者_运维百科hich the row contents product name,barcode,quantity and buy price.I am to delete the particular row by using this jquery

  $('#Delete').live('click',function(row) {
  $(this).closest("tr").removeClass("selected");
   $(this).addClass("selected");
  /**/
  var href = $(this).attr('href');
 $(this).closest('tr').toggleClass('highlight');
$('tr').click(function(){$(this).effect("highlight", {}, 3000);});
var button = $(this);
var ok=confirm("You really want to delete?");

if(ok)
{   
 $(this).closest("tr").remove(); // remove row

    }
return false; // prevents default behavior
 });


IM using this function for that:

function todoDelete(id) {
    $.ajax({
        url: '/todo/delete/' + id,
        success: function() {
            $('#update_' + id).css('backgroundColor', '#ff6666');
            $('#update_' + id).fadeOut(250);
        }
    });
}

But you can modifie as that:

$('a.delete').click(function(link){
    var row = $(link).parent('tr');
    var id = row.children('td.id').html(); // append id class, there is your id
    $.ajax({
        url: '/delete/' + id,
        success: function() {
            row.css('backgroundColor', '#ff6666');
            row.fadeOut(250);
        }
    });
}
0

精彩评论

暂无评论...
验证码 换一张
取 消