我正在使用 AngularJS。现在我想保留我的 html 选择选项的标题。我怎样才能在那里使用......我的代码在这里。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<select class="col-md-12 hkg-nopadding" ui-select2="{allowClear: true}" ng-model="name" id="selectName" name="selectName">
<option value=""></option>
<option ng-repeat="name in names" value="{{name.id}}" title=
"{{name.text}}">{{name.text.length > 50 ? name.text.substring(0, 50) + '...' : name.text}}</option>
</select>
这里的标题标签没有被应用。请帮忙。!
最佳答案
使用aria-label而不是标题属性:
Relying on the title attribute is currently discouraged as many user agents do not expose the attribute in an accessible manner as required by this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or tablet).
引用文献
关于javascript - 我们如何在 angularjs 中的 select 选项上提供标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29406872/