<html> <head> <script> window.onload = function(){ var opts = document.getElementById("select"); var value = 2//这个值就是你获取的值; if(value!=""){ for(var i=0;i<opts.options.length;i++){ if(value==opts.options[i].value){ o
项目中用的jquery1.9 今天需要检测一个checkbox的选中状态,想当然的用 .attr("checked") ,结果发现,无论是否选中,这个值都是 undefined 未定义. 折腾了半天,无奈,只能取jq官网看看文档,发现有这么一段说明 As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. In addition, .attr() shoul