大家好,請原諒我的新手,因為我只是一個初學者。我希望在我的搜索欄中添加一個下拉串列,以便用戶可以在下拉串列中進行搜索。我遇到了一些問題,因為我不知道該怎么做。如果有任何建議可以幸免,將不勝感激。這是與此問題相關的代碼。
<div style="grid-area: jobNumber;" class="body" >
<input type="search" class="noBorder" placeholder="Job Number">
</div>
SASS
.body
background-color: white
color: $primary-text-color
font-size: 1rem
border: 1px solid transparentize($primary-text-color, .7)
border-radius: .25rem
width: 15rem
min-height: 1rem
padding: .375rem .75rem
transform: scale(130%, 130%)
uj5u.com熱心網友回復:
要獲得一個推薦選項的下拉串列,您可以添加一個datalist元素并將其鏈接到您的輸入:
<div style="grid-area: jobNumber;" class="body" >
<input type="search" class="noBorder" list="your-datalist-name" placeholder="Job Number">
</div>
<!-- the ID here and list attribute on your input link the two together -->
<datalist id="your-datalist-name">
<option value="job1">
<option value="job2">
<!-- etc... -->
</datalist>
如果您想將用戶限制在您的值串列中,請參閱此 stackoverflow 問題
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/432658.html
上一篇:如何在計算屬性中獲取插槽道具?
