首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

jquery 操作 select

jQuery获取Select元素,并选择的Text和Value: 1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text 3. var checkValue=$("#select_id").val(); //获取Select选择的Value 4. var checkIndex=$("#select_id ").get(0).selectedIndex; //获取Select选择的索引值 5. var maxIndex=$("#select_id option:last").attr("index"); //获取Select最大的索引值 jQuery获取Select元素,并设置的 Text和Value: 实例分析: 1. $("#select_id ").get(0).selectedIndex=1; //设置Select索引值为1的项选中 2. $("#select_id ").val(4); // 设置Select的Value值为4的项选中 3. $("#select_id option[text='jQuery']").attr("selected", true); //设置Select的Text值为jQuery的项选中 jQuery添加/删除Select元素的Option项: 实例分析: 1. $("#select_id").append("<option value='Value'>Text</option>"); //为Select追加一个Option(下拉项) 2. $("#select_id").prepend("<option value='0'>请选择</option>"); //为Select插入一个Option(第一个位置) 3. $("#select_id option:last").remove(); //删除Select中索引值最大Option(最后一个) 4. $("#select_id option[index='0']").remove(); //删除Select中索引值为0的Option(第一个) 5. $("#select_id option[value='3']").remove(); //删除Select中Value='3'的Option 6. $("#select_id option[text='4']").remove(); //删除Select中Text='4'的Option 三级分类 <select name="thirdLevel" id="thirdLevel" onchange="getFourthLevel()"> <option value="0" id="thirdOption"> 请选择三级分类 </option> </select>

四级分类: <select name="fourthLevelId" id="fourthLevelId"> <option value="0" id="fourthOption"> 请选择四级分类 </option> </select>
.if($("#thirdLevel").val()!=0){ $("#thirdLevel option[value!=0]").remove(); } if($("#fourthLevelId").val()!=0){ $("#fourthLevelId option[value!=0]").remove(); }//这个表示:假如我们希望当选择选择第三类时:如果第四类中有数据则删除,如果没有数据第四类的商品中的为默认值。在后面学习了AJAX技术后经常会使用到!

02

目标检测(object detection)系列(十四) FCOS:用图像分割处理目标检测

目标检测系列: 目标检测(object detection)系列(一) R-CNN:CNN目标检测的开山之作 目标检测(object detection)系列(二) SPP-Net:让卷积计算可以共享 目标检测(object detection)系列(三) Fast R-CNN:end-to-end的愉快训练 目标检测(object detection)系列(四) Faster R-CNN:有RPN的Fast R-CNN 目标检测(object detection)系列(五) YOLO:目标检测的另一种打开方式 目标检测(object detection)系列(六) SSD:兼顾效率和准确性 目标检测(object detection)系列(七) R-FCN:位置敏感的Faster R-CNN 目标检测(object detection)系列(八) YOLOv2:更好,更快,更强 目标检测(object detection)系列(九) YOLOv3:取百家所长成一家之言 目标检测(object detection)系列(十) FPN:用特征金字塔引入多尺度 目标检测(object detection)系列(十一) RetinaNet:one-stage检测器巅峰之作 目标检测(object detection)系列(十二) CornerNet:anchor free的开端 目标检测(object detection)系列(十三) CenterNet:no Anchor,no NMS 目标检测(object detection)系列(十四) FCOS:用图像分割处理目标检测 目标检测扩展系列: 目标检测(object detection)扩展系列(一) Selective Search:选择性搜索算法 目标检测(object detection)扩展系列(二) OHEM:在线难例挖掘 目标检测(object detection)扩展系列(三) Faster R-CNN,YOLO,SSD,YOLOv2,YOLOv3在损失函数上的区别

02

尚能饭否|技术越来越新,我对老朋友jQuery还是一如既往热爱

最近在搭建完善自己的博客,需要用到一些页面样式之类的,就特意问了一下女朋友一个问题,关于Web前端开发,jQuery现在过时了嘛?她毅然决然告诉我,那是我们前端现在的鄙视链。是的,不可否认,现在框架盛行,jQuery早已被GitHub所遗弃。我依稀记得,两年前,我学前端知识,觉得这个框架真的很好,以后有时间,一定要好好学一下它。也就这么点时间,它早已淡出了前端开发者的视线。不过呢,我身为后端开发,也就是一个新人于前端来说,所以我还是很喜欢jQuery的思想,因为让我直接理解Vue/React的话,还是需要大量时间的,所以认为jQuery是一个不错的过渡选择,也可以学习下前端编程思想,我看中了它的人性化以及可读性很强,对于我们来说也很简单,所以本文带大家一起回忆那些jQuery的点点滴滴,也为我们前端知识打个牢固的技术基础。

05
领券