Vinay
Vinay

Reputation: 334

check user chooses an option from dropdown rails

I have a dropdown in which there is a include_blank: "Select city". I want to write a code in which any city(excluding "Select city") is selected I want to disable some fields. But How can I check that any city is selected not message is selected.

<%= f.select 'city_id', grouped_options_for_select(cities), :include_blank: "Select city" , id: nil %>

Thanks in advance.

Upvotes: 0

Views: 36

Answers (1)

Sourabh Upadhyay
Sourabh Upadhyay

Reputation: 1044

If($("#city").val() == ""){
  console.log("");
}else{
 // your code
}

Upvotes: 1

Related Questions