css 如何在选择选择器搜索输入中添加占位符

nuypyhwy  于 2023-02-26  发布在  其他
关注(0)|答案(4)|浏览(194)

我如何把占位符在我的选择器搜索输入,请建议一些想法..

<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>

i86rm4rw

i86rm4rw1#

数据-实时-搜索-占位符=“搜索”

<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>
41ik7eoe

41ik7eoe2#

<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>
hkmswyz6

hkmswyz63#

https://picker.adam-uhlir.me/
或者告诉我你用的是哪个jquery插件?

nimxete2

nimxete24#

您可以使用data-live-search-placeholder在搜索中放置占位符文本,并使用“title”属性更改选择占位符文本。

<label for="job">Jobs</label>

<select id="job" class="selectpicker" multiple title="Select Jobs" data-live-search="true" data-live-search-placeholder="Search">
    <option>job 01</option>
    <option>job 02</option>
    <option>job 03</option>
</select>

相关问题