Javascript Select box Plugin.
A plugin developed with Pure javascript and CSS, that allows selecting value from the select box. This support all major browser with same look and feel as well as devices.

HTML element
<
div
className
=
"jselect"
id
=
"select_0"
></
div
>
Option data format
var
lists =[
"select"
,
"Option 1"
,
"Option 2"
];
Or
var
lists ={
"0"
:
"select"
,
"1"
:
"Option 1"
,
"2"
:
"Option 2"
}
Setting Option object
var
joption = {
"Options"
: lists,
"Id"
:
"select_0"
,
"Label"
:
"Select Outcome"
,
"ajax"
:
true
}
Invoke Method
setTimeout(
function
() {
jselect(joption);
}, 100);
Get Value
var
gval = document.getElementById(
"select_0"
).getAttribute(
"data-value"
);
Set Value
var
sval= document.getElementById(
"select_0"
).setAttribute(
"data-value"
,0);
Change Callback Method
jchange(
"select_0"
,
function
(val, txt) {
// code
});
- val - Select box value
- txt - Display value
Reset function
jreset(
"select_0"
);
Key Events Support
Key
Actions
Tab
Focus the select box
Down
Move to next element
Up
Move to Previous element
Enter
Open the pop up | Select the element
Space
Open the pop up | Select the element
Esc
Close the pop up
Comments