jquery怎么设置class

jquery怎么设置class,第1张

需要准备的材料分别有:电脑、html编辑器浏览器

1、首先,打开html编辑器,新建html文件,例如:index.html,并引入jquery。

2、在index.html中的<script>标签,输入jquery代码:$('input').css('width', '250px')。

3、浏览器运行index.html页面,此时输入框的css样式的宽度被成功设置250px。

var ul = $(“.category-products ul”)

ui.children("li").eq(0).addClass("first")

ui.children("li").eq(2).addClass("last")

写成 $(“.category-products ul li”) 已经丢失了ul和li的父子关系。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11860822.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存