将Bootstrap工具提示添加到表单标签中

时间:2018-07-20 08:59:14

标签: html laravel twitter-bootstrap laravelcollective

我试图将tooltips改成laravelcollective

<div class="form-group col-sm-4">
  {!! Form::label('exchange_id', 'Exchanges:') !!}
  {!! Form::select('exchange_id', [''=>'Choose Options'] + $exchanges , null, ['class'=>'form-control', 'id'=>'exchange', 'name'=>'exchange_id',  'onchange' => 'all_function()'])!!}
</div>

在上面的选择框中,{!! Form::label('exchange_id', 'Exchanges:') !!}我想在Bootstrap工具提示中加上问号,例如 Exchanges?
我该怎么办?

1 个答案:

答案 0 :(得分:1)

您可以将属性添加到label标签,data-toggle="tooltip"title="Exchanges ?"

<div class="form-group col-sm-4">
 {!! Form::label('exchange_id', 'Exchanges:', ['data-toggle' => 'tooltip', 'title' => 'Exchanges ?']) !!}
 {!! Form::select('exchange_id', ['' => 'Choose Options'] + $exchanges, null, ['class' => 'form-control', 'id' => 'exchange', 'name' => 'exchange_id', 'onchange' => 'all_function()'])!!}
</div>

需要引导插件并使用它

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})

工具提示:http://getbootstrap.com/docs/4.1/components/tooltips/

演示:http://jsfiddle.net/xL1vteoj/