bootstrat 设置 select option 选项的值

<script>
    /**
         //把textarea替换成一个编辑器
        UE.getEditor(‘22upTips‘,{
            initialFrameWidth:"80%",
            initialFrameHeight:"200"
        });
    **/
      $(document).ready(function() {
        //select change
        $("#app_type").change(function(){
             var app_type=$(this).val();
             var url="./index.php?module=operation&action=SelectChange";
             var post_value = "app_type="+app_type;
             $.ajax({
                type: "POST",
                 url: url,
                 data: post_value,
                dataType: ‘json‘,
                success: function(data){                  //清空option
                  $("#upVer").empty();
                   if(data==0){
                       alert(‘更新失败‘);
                   }else{
                       $(data).each(function(k,v){
                            //设置option选项
                            document.getElementById("upVer").innerHTML +=v[0].option;
                            $("#mainVer").val(v.mainVer);
                            $("#upTips").val(v.upTips);
                            $("#assetPath").val(v.assetPath);
                            $("#newUpiniPath").val(v.newUpiniPath);
                            $("#appStore").val(v.appStore);
                            $("#forceUpdateVersion").val(v.forceUpdateVersion);

                       });
                       //刷新
                       $(‘#upVer‘).selectpicker(‘refresh‘);
                   }
                }
              });
         });

    });
    </script>

相关资料:http://silviomoreto.github.io/bootstrap-select/

时间: 2024-08-01 11:24:09

bootstrat 设置 select option 选项的值的相关文章

jquery选择器多值情况处理(取select列表选项的值)

//多个同名的select值 var s=$("select[name=dutylistall]"); var dutylistall=""; s.each(function(i,el){ //console.info(i); //console.info(el); //console.info($(el).find("option:selected").val()); if(i!=0){ dutylistall+=",";

js 获取select option中的值或者value值

<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title></head><body><select id="sel" οnchange="cge()">   <option value="1">4</option> 

servlet里获得jsp页面里select的选项之值

  <span style="font-size:24px;"><select name=first> <option value="1">第一</option> <option value="1">第二</option> </select></span> String v=request.getParameter("first")

根据输出设置select的被选中值

$("#startupStatus").find("option").map(function(i) { if ($('#st-status').val() == $(this).val()){ $(this).attr("selected", true); } });

select初始化添加option,通过标签给出回显值,由于回显值和初始化值option中有一个值重复,去重等问题!

第一张图片: 第二张图片 /** *该方法是为了去重,所谓去重就是 因为回显给select附上了值并设置为selected选中状态,而在我们初始化所有的select添加option元素中于回显的值重复,那么就要去除select option中重复值 */ function removeRepeatSelectHour(h){   var $option=$("option:selected",h);//获取被选中,   // alert($option.val());  console

jquery获得select option的值和对select option的操作

1.jQuery获取Select元素,并选择的Text和Value: 1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text 3. var checkValue=$("#selec

jquery 获取和设置 select下拉框的值

<div style="display:block;text-align:left;margin-left:1em;"> <select id="uploadFrequency" style="width:50%;font-size:1em;" onchange="changeFunction()"> <option value="-1" selected="sele

jquery获得select option的值 和对select option的操作【转藏】

获取Select : 获取select 选中的 text : $("#ddlRegType").find("option:selected").text(); 获取select选中的 value: $("#ddlRegType ").val(); 获取select选中的索引: $("#ddlRegType ").get(0).selectedIndex; 设置select: 设置select 选中的索引: $("#d

点击select下拉框获取option的属性值

select下拉框作为前端开发者应该是经常使用的,最近在项目中遇到这样的情况,点击下拉框选项,需要获取所点击的option的属性值,当时想很简单啊,给option加一个点击事件不就行了,然后就加了一下,结果一运行悲催了,怎么点击option事件就是不会执行.这是为什么呢,刚开始也不懂,之前没遇到过这样的需求,后来经过学习,才恍然大悟,原来select option没有点击事件,要想获得所选option的属性值,需要通过jquery的change()方法来获取,下面通过代码解释一下,代码如下: <