2014-09-27 60 views

回答

2

如果您正在使用下拉然後綁定功能的onchange()與選擇標籤選擇標籤。 AS

在HTML

<select id = "status_selector" onchange="fnStatusChanged()"></select> 

在Java腳本

<script> 
    function fnStatusChanged(){ 
    // Write Something 
    } 
    <script> 
1

給出一個標準JQM選擇控件,e.g:

<div class="ui-field-contain"> 
    <label for="select-native-1">Basic:</label> 
    <select name="select-native-1" id="select-native-1"> 
     <option value="1">The 1st Option</option> 
     <option value="2">The 2nd Option</option> 
     <option value="3">The 3rd Option</option> 
     <option value="4">The 4th Option</option> 
    </select> 
</div> 

和標準彈出markp,如:

<div data-role="popup" id="popupDialog" data-overlay-theme="b" data-theme="b" data-dismissible="false" style="max-width:400px;"> 
    <div data-role="header" data-theme="a"> 
     <h1>Selected Val?</h1> 
    </div> 
    <div role="main" class="ui-content"> 
     <h3 class="ui-title">You selected the item with a value of</h3> 
     <p id="selectedVal"></p> 
     <a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-b" data-rel="back" data-transition="flow">OK</a> 
    </div> 
</div> 

您可以處理選擇的變化情況,然後調用彈出的窗口小部件的開放式方法來啓動彈出:

$("#select-native-1").on("change", function() { 
    var val = $(this).val(); 
    $("#selectedVal").html(val); 
    $("#popupDialog").popup("open"); 
}); 

這裏is a working DEMO

相關問題