一般写JS很多人用了JQ这个
$(".divad").on(“click”,function(){
$(this).parent().css(“border”,“solid 1px red”);
$(this).parent().css(“float”,“left”);
});
这个我发现他不能传参数本来JS就该和JQ混用的。
但是很多人用上面的写法让你在很多地方没法传参数,比如说一个选项卡。
如果你传参数就是一个function就可以搞定
function xuanxiang(d.f){
$(d).parent().siblings().find("…").eq(f)…;
KaTeX parse error: Expected 'EOF', got '}' at position 63: …ngs().....; }̲; 就这个。当你在想应的位置加…(".divad").on(“click”,function(){
$(this).parent().css(“border”,“solid 1px red”);
$(this).parent().css(“float”,“left”);
});这个写法哪你们会怎么去做。我是不知道。但我相信绝对比我的这个的代码多很多还得去考虑辑之类的。这就是js封装的好处。本来JQ为我们封装了很多。为什么我们还得去考虑这么多呢你们说是不是。我这个不算入门
JQ中的
最新推荐文章于 2023-07-01 19:06:58 发布