Reputation: 13751
is there a way I can add a click event to a dropdown menu in Meteor? I know how to do it for buttons, but I couldn't find documentation for dropdown menus. My dropdown menu is:
<td>
<select id="orderStatus">
<option value="Submitted">Submitted</option>
<option value="Sent">Sent</option>
<option value="Complete">Complete</option>
</select>
</td>
I want an click event that alerts with the value of the option that i selected. For example, I select "Sent" in the dropdown menu, I want an alert "Sent".
Thank you.
Upvotes: 5
Views: 1880
Reputation: 22696
You need to use a change
event :
Template.myTemplate.events({
"change #orderStatus": function(event, template){
var selectValue = template.$("#orderStatus").val();
console.log(selectValue);
}
});
Upvotes: 9