Question

This is what I want:

class = "navbar-toggle" data-toggle = "collapse" data-target = ".navMenuCollapse"

This is what I got:

class="\"navbar-toggle\" data-toggle = \"collapse\" data-target = \".navMenuCollapse\""

This is what I tried:

<%= link_to 'test', welcome_index_path, {:class => '\"navbar-toggle\" data-toggle = \"collapse\" data-target = \".navMenuCollapse\"'} %>

Is there any opportunity to get quotes in the class-tag ? Thanks for help.

Était-ce utile?

La solution 2

This should work:

<%= link_to 'test', welcome_index_path, :class => 'navbar-toggle', :'data-toggle' => 'collapse', :'data-target' => '.navMenuCollapse' %>

Autres conseils

Try the below code:

<%= link_to 'test', welcome_index_path, class: 'navbar-toggle', data: {toggle: 'collapse', target: '.navMenuCollapse'} %>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top