jQuery获取this当前对象子元素对象的方法

Original 2017-01-11 15:22:10 356
abstract:如下所示: $(function(){ $("#city").change(function(){ ①// 已获取SELECT为当前this元素 }) })

如果想要在①获取选中option的值可以有如下方法

$("#city option:SELECTed").val(); //使用选择器 $(this).children('option:SELECTed').val() //使用this

有时候我们会想当然的这样写 $(this “a”), $(“this a”)之类,这样是不对的

更多关于jQuery获取this当前对象子元素对象的方法请关注PHP中文网(m.sbmmt.com)其他文章!

Release Notes

Popular Entries