jquery 純JS設置select下拉框,並默認選中第一個


//html頁面
<select id="payWay" class="easyui-combobox" name="payWay" style="width: 100%;" data-options="required:true,editable:false"> </select>

 

 

 

//JS文件
function getPayedWay(){ $.ajax({ type :
"GET", url : top.baseUrl + "auction/settlement_bail/get/payed/type", data : null, dataType : 'json', success : function(result) { var typeStr = ''; $.each(result, function(index, temp) { typeStr += '<option value=' + temp.id + '>' + temp.name + '</option>'; }); $('#payWay').html(typeStr); $('#payWay').combobox({}); var data = $('#payWay').combobox('getData'); $("#payWay").combobox('select',data[0].value); }, error : function(result) { } }); }

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM