javascript - Using CoffeeScript to select default value for select box -


i'm trying set default value of select box. here current failed attempt.

  $("#event_location_country").on "load", () ->     $(this).val("us") 

html

  <%= f.select :location_country, countries, {}, class: "form-control", required: true %>   <%= f.label :location_country, class: "form-note" %> 

here html console:

<option value="us">united states</option> 

obviously other countries of world want default on page load. also. there in easier way html?

have tried this?

<option value="us" selected>united states</option> 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -