groenroos/minimalect — pull request #12 by wjohnald (2013-05-29 22:22:53+00:00)
Title: Support for resetting the element to empty state

Many of my un-enhanced select elements have a "placeholder" option. This is an option with en empty value and text that serves as a place holder.

Though Minimalect does not allow you to choose an empty option, it is sometimes useful to "reset" the plugin's view by manually selecting the empty option. I have added support for resetting the enhanced select widget using the following syntax:

$('select').val('').change();

This is inline with the regular flow of Minimalect.

I have made sure to ignore empty options in the parseElements function. I achieve this effect by supplying a different callback in the change handler depending on whether or not the element's value is empty.