Rails - add HTML attribute without setting value

I am trying to create an image_tag and specify a data attribute that does not have any value set for it. I'm trying to add a data tooltip for use with Foundation 5. Tooltips. It seems that if any value is really set to this, Foundation uses the same tooltip text each time and ignores the title attribute of this element (so each tooltip will say, that the first one you depended on was ... which seems to be a mistake both on its own and on part of the Fund)

This is what I need to generate:

<img src="[whatever]" title="My Tooltip" data-tooltip />

This will not work for me:

<img src="[whatever]" title="My Tooltip" data-tooltip="[insert anything here]" />

I tried several different combinations and read the documentation, but it seems that whatever I select the value, it calls it as data-tooltip = "null" or true or false or any line that I pass.

image_tag(my_image, class: 'has-tip', title: "My Title Here", data: { tooltip: true })
+4
source share
4 answers

Try passing an empty string as follows:

image_tag(my_image, class: 'has-tip', title: "My Title Here", data: { tooltip: "" })
+5
source

In Rails 4.1.4, using the :"data-tooltip" => ''tip above, displays a data hint with no value.

+4
source

, multiple <input multiple type="file">, , . input_html: { Multiple: '' } .

0

rails 5 itemscope :

    <%= link_to example_path(@example) do %>
      <span>
        <%= @example.name %>
      </span>
    <% end %>

html a, itemscope - :

<a itemscope href="example/path">
    <span>
       some text
    </span>
</a>

, itemscope ="" itemscope="itemscope".

SO , , , - link_to link_to: " itemscope" => ''. itemscope.

, schema.org google ( , ).

0

All Articles