This is a solution to the desire to have <select>
drop down lists with its <option>
elements have flexible formatting in their text.
The class will create a mimic of any chosen <select>
, hiding the original and pushing selected values into the original when changes are made to the mimic, triggering any onchange events that may be attached to the original.
Also handles <optgroup>
's if included.
Pros
<select>
<select>
<option>
's and <optgroup>
'sCons
To implement :
mf-styled-selector.js
and mf-styled-selector.css
html :: local installation
or
html :: methodfish.com reference
mf-select
class on any <select>
's that want to apply.<option>
entries to control the formatting required for the values; it is also advisable to include the mf-invisible
class on your <select>
to avoid the pre-formatted value from being visible before it's ready.error_outline{select
items (e.g. through select {... '>
or specifically pointing at the id of a <select>
e.g. #myselect
then you will need to make adjustments to use the mf-select instead).
The special simplified MD includes:
**...** | Bolding text |
///.../// | Italics |
{col xxxx}...{ | change text color to xxxx (e.g. red or #ff0 , or if xxxx starts with . then it will use the class name xxxx (i.e. .xxxx ) |
html
By default, on window load, the class will be initiated, but if necessary you can call this manually using the init() function after the .mf-select classes have been put on the DOM:
javascript
Note, the provide MD here is limited but can be extended if desired by declaring your own MD handler to return your desired markup.
javascript
Also see
articles/Implementing-a-Monaco-Editorsquarearticles/iConnectionTestsquarearticles/javascript-camerasquarearticles/list-editsquarearticles/minifierssquarearticles/opayosquarearticles/table-drag-sortersquarearticles/typewatchsquareprojects/MFCalendarPopupsquareprojects/MFChartColumnsquareprojects/MFColorPickersquareprojects/MFColorPickerBasicsquareprojects/MFColumnGradientsquareprojects/MFFloatawayMsgsquareprojects/MFPanelssquareprojects/MFSelectorsquare
Comments
New Comment