one 6条回答 独厮守ぢ (楼主) 2021-01-12 13:02 var $this = $(this); if (typeof $this.attr("id") != "undefined" && $this.attr("id").length > 0) { ... } If you're going to use $(this) more than once, it's advised to find it once, and put the resulting jQuery object in a local variable. 0 讨论(0) 查看其它6个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
var $this = $(this); if (typeof $this.attr("id") != "undefined" && $this.attr("id").length > 0) { ... }
If you're going to use $(this) more than once, it's advised to find it once, and put the resulting jQuery object in a local variable.
$(this)