2015-02-06 115 views
0

我有幾個rails link_to helper打開模式窗口,但工作正常但我還需要使用選擇框來選擇狀態和更改選擇我需要打開一個鏈接取決於關於select的狀態值。我的鏈接的jquery鏈接打開模式窗口

<%= link_to "Fact Find", fact_find_email_path(@opportunity.contacts.first.id), {:remote => true, 'data-toggle' => "modal", 'data-target' => '#fact_find'} %> 

jQuery腳本我到目前爲止

$('#status').change(function() { 
    //some if statement to eval selection e.g if #status == 'Fact Find' 
    // Then open the link as above 
     }); 
+0

所以最新你的問題隊友.. ?? – Outlooker 2015-02-06 04:39:57

+0

我不知道如何寫jQuery的鏈接 – Shooter533 2015-02-06 06:17:06

回答

1

像這樣的東西可以幫助你隊友.. :)

$('#status').change(function() { 
    if ($(this).val() == "someValue") { 
     $("#link_id").trigger("click"); 
    } 
}); 

FYI

Trigger

+0

謝謝!!得到它了 – Shooter533 2015-02-08 22:56:09