使用link_to创建下拉菜单,点击后会重定向到页面?

时间:2013-11-20 12:15:30

标签: html ruby-on-rails ruby hyperlink

<h2>Where are you from?</h2>
    <form>
        <select name="URL" onchange="window.location.href= this.form.URL.options[this.form.URL.selectedIndex].value">
        <option value="#">Connecticut</option>
        <option value="#">Michigan</option>
        </select>
    </form>

我想将已删除的值链接到pages_connecticut_path和pages_michigan_path

1 个答案:

答案 0 :(得分:0)

解决这个问题:

<option><%= link_to 'Connecticut', pages_connecticut_path %></option>
<option> <%= link_to 'Michigan', pages_michigan_path %></option>