开发者

Get the closest tr value in JavaScript function

I am having table which contain some data. This table is generating using a component. All td's has the same class name. Each row begins with a check-box with a specific value to that row. When click on a td on that row I want to get check-box v开发者_运维知识库alue. When I click on a label JavaScript function is triggered. Cannot use jQuery click function.


sample: http://jsfiddle.net/gCGVJ/

$('td').click(function() {
    alert($(this).closest('tr').find('input[type=checkbox]').val());
});


$('td').click(function(){

    var val = $(this).closest('tr').find('#checkbox').val();

});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜