首页 > 技术文章 > html combobox select控件设置默认选项

yuzhould 2015-11-30 18:21 原文

就想找个设置html combobox或者select默认选项的代码,百度搜了半小时不知所云的内容,其实很简单,代码如下

js的方式:

var index = 你的下标

getElementById("id").selectedIndex= index ;

 

jqurey的方式:

var index = 你的下标

$("#id")[0].selectedIndex = index;

 

推荐阅读