【问题标题】:Selectpicker title change text选择器标题更改文本
【发布时间】:2016-02-02 05:01:40
【问题描述】:

我正在使用https://silviomoreto.github.io/bootstrap-select/。我正在使用多选下拉菜单。在选择某些项目时,它会显示其默认标题“x items selected”。我想将其文本更改为“x some_other_word selected。”。有人告诉我,如果这个插件提供任何更改标题文本的选项。

【问题讨论】:

    标签: javascript html css twitter-bootstrap drop-down-menu


    【解决方案1】:

    不要使用“计数格式”,而是使用

    <select class="selectpicker" multiple data-selected-text-format="count>3">
     <option>Mustard</option>
      <option>Ketchup</option>
      <option>Relish</option>
      <option>Onions</option> </select>
    

    或者您可以直接编辑插件并添加扩展选项来定义您的默认“选定”文本格式。

    【讨论】:

    • "
    【解决方案2】:

    将标题值添加到“x some_other_word selected”。

     <select class="selectpicker" title="x some_other_word selected.">
    <option>Mustard</option>
    <option>Ketchup</option>
    <option>Relish</option>
    </select>
    

    【讨论】:

    • x 是选择的项目数,而不是一些随机变量。
    【解决方案3】:

    你可以使用“data-count-selected-text”

    <select class="selectpicker" multiple data-selected-text-format="count>3"
        data-count-selected-text= "{0} some_other_word selected">
         <option>Mustard</option>
          <option>Ketchup</option>
          <option>Relish</option>
          <option>Onions</option>
    </select>
    

    【讨论】:

      猜你喜欢
      • 2012-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-08
      • 2019-07-10
      • 1970-01-01
      • 1970-01-01
      • 2012-09-29
      相关资源
      最近更新 更多