Notice: Undefined index: Operating System in /var/www/youngstory/admin/track/ip.php on line 127

Notice: Undefined index: Operating System in /var/www/youngstory/admin/track/ip.php on line 160

Javascript Select box Plugin

javascript
1590
Views
0
Comments

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.

javascript select box plugin

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
});
  1. val - Select box value
  2. 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

Good articles
Reply
Good articles