【发布时间】:2012-05-28 10:44:55
【问题描述】:
谁能帮我理解下面的JS代码,拜托:
$(function(){ <-- Is this a JS constructor? Why we need this?
var someVariable = $(".classa").on('click', function() { <-- At what point in time does someVariable get populated?
var $this = $(this);
id = $this.attr('id');
someVariable.removeClass('selected');
});
var someVariable2 = $(".classb").on('click', function() {
var $this = $(this);
id = $this.attr('id');
someVariable2.removeClass('selected');
});
});
【问题讨论】:
标签: javascript jquery