我想驗證我的tabout.The下拉列表下拉列表中所示驗證了
<div class="form-group">
<label class="col-sm-2 control-label labelfont">Select a Provider Type:</label>
<div class="col-sm-10" id="ProviderType">
<select class="form-control">
<option>Select a Provider Type</option>
<option>Doctor</option>
<option>Facility</option>
</select>
</div>
</div>
我寫了下面的代碼,以獲得標籤了
$("#ProviderType").on("blur", function() {
if ($("this")[0].selectedindex <= 0)
alert("Please choose a Provider");
});
警報選項卡上的一個下拉列表
上面的代碼沒有工作,
所以,我想這個代碼不工作,要麼
$("#ProviderType option:selected").on("blur", function() {
if ($("this").text() == "Select a Provider Type")
alert("Please choose a Provider");
});
任何幫助,將不勝感激guys.Thanks提前。
建議我使用.bind()方法做了一些事件處理。
$("#Certification").bind("blur",function() {
alert("Event binding is working fine.")
});
我看到一個警報,當Tabdown出Dropdownlist.I仍然沒有看到錯誤雖然。請指導我。
它怎麼不起作用?你在控制檯上發現任何錯誤嗎? –
沒有..沒有錯誤。我有一個警告與淘汰賽有關。 –
代碼運行時,元素是否存在?嘗試委託事件 – charlietfl