문제

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.

도움이 되었습니까?

해결책 2

This should work:

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

다른 팁

Try the below code:

<%= link_to 'test', welcome_index_path, class: 'navbar-toggle', data: {toggle: 'collapse', target: '.navMenuCollapse'} %>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top