Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax for bootstrap tooltip on erb form?

I'm writing a form in rails, styled with Bootstrap 3. My goal is to trigger a tooltip (left) when a user clicks on an input field. I know how to do this with a standard input field, but am at a loss on how to do the same with erb, as follows.

<div class="form-group">
      <%= label_tag :teachables, "What do you think you can teach?" %>
      <%= f.text_field :teachables, class: 'form-control', placeholder: 'Like piano, sewing, music, etc' %>
    </div>

This is the standard bootstrap markup:

<button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="Tooltip on right">Tooltip on right</button>
like image 357
John Thomas Connor Avatar asked Sep 04 '26 15:09

John Thomas Connor


1 Answers

Try:

<div class="form-group">
  <%= label_tag :teachables, "What do you think you can teach?" %>
  <%= f.text_field :teachables, class: 'form-control', placeholder: 'Like piano, sewing, music, etc', data: {toggle: "tooltip", placement: "left" }, title: "tooltip on second input!" %>
</div>
like image 187
Mandeep Avatar answered Sep 07 '26 09:09

Mandeep



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!