jQuery过滤Gridview列

时间:2010-06-18 12:51:51

标签: asp.net jquery gridview

我希望所有列都有一个click事件,但是GridView的最后一列,然后为gridview的最后一列(DropDownList)单独点击事件。我现在有以下内容,但似乎无法排除最后一列:

var _activeRow;
$('.gridview-jquerify tr').filter(function() {
     return $('td', this).length && !$('table', this).length
})
.bind('click', function(e) {
     if (_activeRow) _activeRow.removeClass('gridviewrow-highlighted');
     _activeRow = $(this).addClass('gridviewrow-highlighted');
     $(this).each(function() {
          var myID = $(this).find('.gridview-cell-hide').html();
      __doPostBack('MyUpdatePanel', myID);
     });
});

然后我似乎无法通过使用以下选项进行过滤来获得上述变体以用于最后一列:最后一个选择器如下:

$('.gridview-jquerify tr >td:last').filter(function() {
     return $('td)', this).length && !$('table', this).length
})

2 个答案:

答案 0 :(得分:1)

//Selects all but last column

$(".gridview-jqueryify tr td:not(:last-child)")

//Selects last column

$(".gridview-jqueryify tr td:last-child")

答案 1 :(得分:0)

将jQuery嵌入Chrome控制台的完美扩展程序尽可能简单。如果jQuery已经嵌入到页面中,这个扩展也会提出异议。

此扩展用于将jQuery嵌入到您想要的任何页面中。它允许在控制台shell中使用jQuery(您可以通过“Ctrl + Shift + j”调用Chrome控制台)。

要将jQuery嵌入到选定的选项卡中,请单击“扩展”按钮。

链接到扩展程序:https://chrome.google.com/extensions/detail/gbmifchmngifmadobkcpijhhldeeelkc

相关问题