0
劍道UI addClass(「K-狀態錯誤」),我有以下的html代碼:在第二區間
<span aria-activedescendant="categoria_option_selected" aria-busy="false" aria-readonly="false" aria-disabled="false" aria-owns="categoria_listbox" tabindex="0" aria-expanded="false" aria-haspopup="true" role="listbox" unselectable="on" class="k-widget k-dropdown k-header k-state-error" style="width: 200px;">
<span unselectable="on" class="k-dropdown-wrap k-state-default">
<span unselectable="on" class="k-input"></span>
<span unselectable="on" class="k-select">
<span unselectable="on" class="k-icon k-i-arrow-s">select</span>
</span>
</span>
<select data-role="dropdownlist" name="categoria" id="categoria" style="width: 200px; display: none;">
<option selected="selected" value=""></option>
<option value="Affiti + Utilities">Affiti + Utilities</option>
<option value="Stipendi + Contributi">Stipendi + Contributi</option>
<option value="Consumo Mensile">Consumo Mensile</option>
<option value="Voip">Voip</option>
<option value="Internet">Internet</option>
</select>
</span>
我要添加到第二跨度類:基於選擇addClass('k-state-error')
並刪除removeClass('k-state-default')
ID。
我曾嘗試:
$('#categoria').closest('.k-state-default').removeClass('k-state-default').addClass('k-state-error');
和: $('#categoria').parent('span').removeClass('k-state-default').addClass('k-state-error');
這增加了全班第一跨度。
感謝隊友,它的工作 – Alex