w3co/jcf

onchange of select

Opened this issue · 1 comments

I have a dropdown of country list. I set a function which get call at onChange event and console the current selected value. When I type IN then its getiing called two times

so console show Iceland and India, general dropdown dont do so

Moreover, the change event is generated when the item which is already selected is selected again. Native selects do not behave this way.

See the code:

		onSelect: function() {
			this.refresh();

			if (this.realElement.prop('multiple')) {
				this.repositionDropdown();
			} else {
				this.hideDropdown();
			}

			this.fireNativeEvent(this.realElement, 'change');
		},

'change' event is triggered even if we don't change the selection. This must be fixed by checking the selected item before triggering the event here.