1. 程式人生 > >jquery外掛spinner,注意事項

jquery外掛spinner,注意事項

 

<!-- 選單新增 Start -->
<div class="col-sm-10" id="addMenuDiv" style="display: none;width: 100%">
    <div class="panel panel-default">
        <div class="panel-body">
            <form class="form-horizontal" id="addMenuForm" novalidate="novalidate">
                <div class="form-group">
                    <label class="control-label col-sm-3">關聯應用:</label>
                    <div class="col-sm-9">
                        <select name="systemId" id="addMenuSystem" class="form-control">
                            <option value="0">統一使用者認證系統</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="menuOrder" class="control-label col-sm-3"> 排序:</label>
                    <div class="col-sm-9">
                        <div id="addSpinner4">
                            <div class="input-group">
                                <input type="text"  name="menuOrder" value=0 class="spinner-input form-control" maxlength="4" placeholder="">
                                <div class="spinner-buttons input-group-btn">
                                    <button type="button" class="btn btn-default spinner-up">
                                        <i class="fa fa-angle-up"></i>
                                    </button>
                                    <button type="button" class="btn btn-default spinner-down">
                                        <i class="fa fa-angle-down"></i>
                                    </button>
                                </div>
                            </div>
                        </div>
</div> </div> <div class="form-group"> <div class="col-xs-12 p-t-10"> <button type="button" class="btn btn-purple resourceWindowClose pull-right">取消</button> <button type="submit" class="btn btn-success pull-right m-r-10" id="submitAddMenuForm">儲存</button> </div> </div> </form> </div> </div> </div> <!-- 新增選單 End -->

 

js

 

var modVars = {
    "addSpinner4": null
};
// 彈窗 - 新增選單
$("#addMenu").on("click", function () {
    openWindow('新增功能', 'addMenuDiv', ['487px', 'auto']);
    // 不能每次開啟的時候都呼叫 $('#addSpinner4').spinner({value: 0, min: 0, max: 999})
    if (!modVars.addSpinner4) {
        modVars.addSpinner4 = $('#addSpinner4').spinner({value: 0, min: 0, max: 999})
    } else {
        modVars.addSpinner4.spinner("value", 0)
    }
$('#addMenuForm')[0].reset(); // 清空表單 });