当我用一类父母点击tr上的任何地方时,我试图触发一个动作.当我点击其中一个下拉框时排除.
$('tr.parent')
.css("cursor", "pointer")
.click(function (e) {
if($(e.target).not('select')){
// do something
}
Run Code Online (Sandbox Code Playgroud)
我尝试以下但这不起作用.
This should solve the issue for both Chrome and Firefox:
$('tr.parent')
.css("cursor", "pointer")
.click(function (e) {
if ($(e.target).is('select') || $(e.target).is('option')) {
//
} else {
$(this).css('background-color', 'red');
}
});
$('tr[class^=child-]').find('td > div, td').hide();
Run Code Online (Sandbox Code Playgroud)
Edit: Simplified version if you don't need to do any action when the select is clicked.
$('tr.parent')
.css("cursor", "pointer")
.click(function (e) {
if (!($(e.target).is('select') || $(e.target).is('option'))) {
$(this).css('background-color', 'red');
}
});
$('tr[class^=child-]').find('td > div, td').hide();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
96 次 |
| 最近记录: |