Shooter533
Shooter533

Reputation: 35

Jquery link to open a modal window

I have a several rails link_to helper that opens modal windows that works fine however I also need to use a select box to choose a status and on change of the select I need to open a link depending on the status value of the select.

Example of my link

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

jquery script I have so far

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

Upvotes: 0

Views: 102

Answers (1)

Nibin
Nibin

Reputation: 3960

Something like this might help you mate.. :)

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

FYI

Trigger

Upvotes: 1

Related Questions