扫码关注官方订阅号
贴出我的代码,但是感觉这个方法太low,求教更好的方法:
test5 选项C 选项D 选项B 选项E 选项A
认证高级PHP讲师
这个题目是为了考察arr.sort([compareFunction])吧。
arr.sort([compareFunction])
compareFunctionOptional. Specifies a function that defines the sort order. If omitted, the array is sorted according to each character's Unicode code point value, according to the string conversion of each element.
$('#myselect').html($('#myselect > option').sort(function(a,b){return $(a).attr('val') > $(b).attr('val')}));
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这个题目是为了考察
arr.sort([compareFunction])吧。