当前位置: 主机百科 » 资源 » 技术 » 正文

JQuery根据指定值动态设置select下的option选中或禁用

JQuery根据指定值动态设置select下的option选中或禁用:

1
  $(function(){      var date=new Date;      var month = date.getMonth()+1;      $("#list").find("option[value = '"+month+"']").attr("selected","selected");//动态设置选中      $("#list").find("option[value = '"+month+"']").attr("disabled","disabled");//动态设置禁用  })

未经允许不得转载:主机百科 » JQuery根据指定值动态设置select下的option选中或禁用

相关文章