许自己一个未来 发表于 2013-1-29 08:39:34

js和jquery操纵select

1 、jquery操作select<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

 
<div class="quote_div"> $(“.selectEd”).find(“option:selected’).text();获取选中的select的值


       $(“#selectId option[‘index=0’]”).remove();删除索引为0的option


       $(“#selectId option[‘value=3’]”).remove();删除value为3的值


       $(“#selectId”).change(function (){......});


$(“#selectId”).append(“<optionvalue=”value”>text</option>”);为select追加一个option(下拉项)


var index = $(“#selectId”).find(“option:selected”).index();//获取选中共的option的index
页: [1]
查看完整版本: js和jquery操纵select