检测具有相同类的其他项目,而不是使用not(this)
Detect other items with same class other than with not(this)
在某些情况下,选择除当前类别之外的具有相同类别的所有项目非常方便:
$('.checkbox_handler').not(this).prop('disabled');
其工作良好。但现在我遇到了this
的一个小问题(双关语)。在启用此规则的情况下,我将ESlint用于任何JS/jQuery linting。从那以后,我不断地收到no-invalid-this Unexpected 'this'
错误。
我现在的问题是:有没有办法使用.not(this)
来检测任何不是当前元素的相同类。还是我没有看到大局?
编辑:根据要求显示更多代码
{
otherFunctions: function() {},
disableInput: function(selector) {
$(selector).on('change', function() {
$('.checkbox_handler').not(this).prop('disabled', function(i, value) {
return !value;
});
});
}
}
完全标记。所有这些都在一个对象中,我正在其中迭代函数。
好的,所以你的js看起来是有效的。我建议将"e"或"event"作为处理程序的参数,并为"this"引用e.target。
https://developer.mozilla.org/en-US/docs/Web/API/Event/target
相关文章:
- $(this).prop('property') vs. this.property
- Twitter Bootstrap typeahead:使用“this”获取上下文/调用元素
- This.props.dispatch not a function - React-Redux
- 使用this和not组合两个jQuery语句
- 为什么回调函数after not($(this))重复多次
- $(this) toggleClass not working with .each?
- 检测具有相同类的其他项目,而不是使用not(this)
- jQuery $(this).closest("form").submit(); not execu
- this.href not returning href
- undefined is not a function when evaluating 'this.batman
- jQuery why this does not work $(":input").change(f
- $(this) not "refreshing"(文档).在美元(& # 39;点击# 39;)
- 未捕获的ReferenceError: this is not defined"在类构造函数中
- How do i formulate "if this.children.has.not.class"
- not选择器可以和'this'一起使用吗?
- jQuery blur() not listening to $(this)
- react native this.refs.nav is not defined
- d3 this.getBBox().x not working
- setTimeout("this.disabled=false",3000); is not wor
- jQuery: $(this).attr('id') not find id of element -