javascript - On typing character on drop down it is selecting any random match from options and triggering change event -
below code in backbonejs + coffeescript.
scenario: open countries drop down , type 'i' select countries starting 'i' typing triggers change event drop down gets closed
expected: drop down should not closed , should highlight countries starting 'i'
i trying event triggered on select of options
note: have used jquery easy drop down plugin link
backbonejs code -
class brown.views.home.operatorsignup extends backbone.view events: 'change #country' : 'getstate' getstate: (event)-> unless _.isempty($('#country').val()) $('#state').html @statestemplate(states: '')
html code -
<div class="form-group colcountry customselectrow"> <select id='country' name='country' class="form-control search"> <option value="" class="countrylabel">country</option> <% _.each(countries, function(val, key, object){%> <option value='<%=key%>'><%=val%></option> <% }) %> </select> <label class="floatinglabel">country</label> </div>
as per documentation of plugin found @ link provided, can register callback onselect while appluing easydropdown on select element follows
$(function(){ var $selects = $('id-for-select'); $selects.easydropdown({ onselect: function(selected){ // } }); });
so guess can use instead of change event.
Comments
Post a Comment