Set default to Not Selected Bootstrap country picker.

huangapple go评论80阅读模式
英文:

Set default to Not Selected Bootstrap country picker

问题

I'm here to provide the translated content. Here's the translated part of your text:

使用Bootstrap国家选择器,我正在使用下面的代码来填充国家列表。它可以正常工作,但没有默认的“未选择”选项。是否有解决方法...?

<script>
  $('.countrypicker').countrypicker();
</script>

<select class="form-control selectpicker countrypicker" id="country" name="country" data-flag="true" data-default=""></select>
英文:

With Bootstrap country picker, I am using the code below to populate countries. Its working fine but there is no "Not Selected" default. Is there a work around for this...?

&lt;script&gt;
  $(&#39;.countrypicker&#39;).countrypicker();
&lt;/script&gt;

    &lt;select class=&quot;form-control selectpicker countrypicker&quot; id=&quot;country&quot; name=&quot;country&quot; data-flag=&quot;true&quot; data-default=&quot;&quot;&gt;&lt;/select&gt;

答案1

得分: 2

如果你想更改文本 'Nothing Selected',请将标题属性设置为你需要的内容。

例如:title="My Custom Text"

<select class="form-control selectpicker countrypicker" id="country" name="country" data-flag="true" title="My Custom Text"></select>
<button>添加选项</button>
英文:

If you want to change the text 'Nothing Selected', set the title property to whatever you need.

eg: title="My Custom Text"

&lt;select class=&quot;form-control selectpicker countrypicker&quot; id=&quot;country&quot; name=&quot;country&quot; data-flag=&quot;true&quot; title=&quot;My Custom Text&quot;&gt;&lt;/select&gt;
&lt;button&gt;Add option&lt;/button&gt;

huangapple
  • 本文由 发表于 2023年5月25日 20:08:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76332123.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定