先判断<ul>  下  <li>标签是否为空,为空则弹出窗体提示

tech2024-01-16  74

功能:先判断<ul>  下  <li>标签是否为空,为空则弹出窗体提示

HTML:

<div class="form-group"> <label class="col-sm-4 control-label">报修类型:</label> <div class="col-sm-4"> <div class="input-group"><!--保持内联,消除边框,类似于form-inline--> <input type="text" class="form-control" name="workType" id="workType" readonly="true" required> <div class="input-group-btn"><!--不换行,与相邻元素内联,包含dropdown--> <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" onclick="remind()" aria-expanded="false"> 请选择<span class="caret"></span> </button> <ul id="workTypeList" class="dropdown-menu"> </ul> </div> </div> </div> </div>

JS:

function remind() { if($("#workTypeList").has("li").length > 0){ }else { $.modal.alertError("请先选择报修类型"); } }

 

最新回复(0)