gpt4 book ai didi

Javascript oop 基础知识

转载 作者:行者123 更新时间:2023-11-29 15:00:35 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
$(document).ready shorthand

有人可以帮助我理解下面的 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');
});
});

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com