如何在selectpicker搜索输入中添加占位符

时间:2018-07-27 09:54:25

标签: jquery html css

如何将占位符放入我的selectpicker搜索输入中,请提出一些想法。

<div class="form-group">
  <label class="control-label " for="select"><span class="clrRed">*</span>abc</label>
  <select class="select form-control selectpicker empty" id="existingJob" name="existing-job" data-live-search="true" required>
    <option value="" selected="true" disabled="true" class="placeholder">ht ht ht </option>
    <option value="Job01">Job 01 </option>
    <option value="Job02">Job 02</option>
    <option value="Job03">Job 03</option>
    <option value="Job04">Job 04</option>
  </select>
</div>

selectpicker search input

4 个答案:

答案 0 :(得分:0)

<select>
    <option value="" selected disabled>Please select</option>
    <option value="Job01">Job 01 </option>
    <option value="Job02">Job 02</option>
    <option value="Job03">Job 03</option>
    <option value="Job04">Job 04</option>
</select>

答案 1 :(得分:0)

尝试看看这篇文章吗? How do I make a placeholder for a 'select' box?这将回答您的问题。

答案 2 :(得分:0)

https://picker.adam-uhlir.me/

还是告诉我您正在使用哪个jquery插件?

答案 3 :(得分:0)

data-live-search-placeholder =“搜索”

<select class="selectpicker" data-live-search="true" data-live-search-placeholder="Search">
  <option value="Job01">Job 01 </option>
  <option value="Job02">Job 02</option>
  <option value="Job03">Job 03</option>
  <option value="Job04">Job 04</option>
</select>