layui框架下實現單選按鈕監聽


<label class="col-sm-2 control-label">類型:</label>
<div class="col-sm-4">
<label class="radio-box"><input type="radio" th:checked="@{(${user.type == 0}? 'true' : 'false')}" value="0" id="type1" name="type">用戶</label>
<label class="radio-box" id="type2Label"><input type="radio" th:checked="@{(${user.type == 1}? 'true' : 'false')}" value="1" id="type2" name="type" >測試</label>
<label class="radio-box" id="type3Label"><input type="radio" th:checked="@{(${user.type == 2}? 'true' : 'false')}" value="2" id="type3" name="type">管理員</label>
</div>


$(function() {
$('input').on('ifChecked', function(event){
var menuType = $(event.target).val();
var isManageSubLabel = $("#isManageSubLabel");
var isManageSubDiv = $("#isManageSubDiv");
isManageSubLabel.hide();
isManageSubDiv.hide();
if (menuType == "1") {
isManageSubLabel.show();
isManageSubDiv.show();
}
});
});


免責聲明!

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



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