Jul 11, 2014 in Forms 7424 views
Select or Die is a jQuery plugin to style select elements. Once a selection has been made the placeholder will be removed until the user clicks the Select or Die again. You can also add a prefix that’s displayed in front of the selected option.
Source: vst.mn
1. INCLUDE CSS AND JS FILES
<link href="../_src/selectordie.css" rel="stylesheet" type="text/css"> <script src="!inc/js/jquery-1.8.0.min.js"></script> <script src="../_src/selectordie.min.js"></script>
2. HTML
<select class="basic"> <option value="one">One</option> <option value="two">Two</option> <option value="three">Three</option> <optgroup label="Option Group Label"> <option value="group.one">Option Group.One</option> <option value="group.two">Option Group.Two</option> </optgroup> <option value="four">Four</option> <option value="five">Five</option> </select>
3. JAVASCRIPT
$("select").selectOrDie();
4. OPTIONS
Option | Type | Description |
---|---|---|
customID | string | Add a custom class to the SoD element |
customClass | string | Add a custom class to the SoD element |
placeholder | string | Add a placeholder that's show before a selection has been made |
prefix | string | Add a prefix that's always shown before the selected option |
cycle | boolean | Keyboard support is always enabled, but if you set this to true the end user will be able to cycle the list of options. Example: when you've reach the bottom of the list and press the down/right arrow key it will jump back up to the first option. |
links | boolean | Treat the options as links? |
linksExternal | boolean | Treat the options as external links? |
size | integer | Do you have a long list of options? Set thesize to control how many options that's visible in the SoD before the need to scrol |
tabindex | integer | Set a custom tabindex on the SoD |
onChange | function | Provide a callback that will fire when a selection has been made |
Tagged with:
select or die
jquery plugin
select elements
style select
multiple selects
selection
selected option
arrow keys
Related Articles