我的HTML無法目標兌現選擇下拉列表項目
<div id="address-book" class="col s6">
<label>ADDRESS BOOK</label>
<select class="clean-input">
<option disabled selected>Choose Address</option>
<option>Saved address 1</option>
<option>Saved address 2</option>
<option>Saved address 3</option>
</select>
</div>
什麼materialize
產生:
<div id="address-book" class="col s6">
<label>ADDRESS BOOK</label>
<div class="select-wrapper clean-input initialized"><span class="caret">▼</span><input type="text" class="select-dropdown" readonly="true" data-activates="select-options-77f55358-fb61-17c0-08b1-78d72bff710c" value="Choose Address">
<ul id="select-options-77f55358-fb61-17c0-08b1-78d72bff710c" class="dropdown-content select-dropdown ">
<li class="disabled "><span>Choose Address</span></li>
<li class=""><span>Saved address 1</span></li>
<li class=""><span>Saved address 2</span></li>
<li class=""><span>Saved address 3</span></li>
</ul>
<select class="clean-input initialized">
<option disabled="" selected="">Choose Address</option>
<option>Saved address 1</option>
<option>Saved address 2</option>
<option>Saved address 3</option>
</select>
</div>
</div>
我試圖爲目標的下拉列表項目:
$('#address-book div ul li').on('click', function(){
$(alert('yes'));
});
我嘗試了多種不同的方式鑽取到列表項中,但它們不起作用。我創建了精確的向下鑽取作爲測試並且警報起作用。
我需要的列表項爲目標,而不是UL。由於物化產生這個,我不能硬編碼類到列表項。 –
@SpencerWest查看更新後的答案 – dippas