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.

Was it helpful?

Solution 2

This should work:

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

OTHER TIPS

Try the below code:

<%= link_to 'test', welcome_index_path, class: 'navbar-toggle', data: {toggle: 'collapse', target: '.navMenuCollapse'} %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top