
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
Selectbox is a simple and flexible jQuery plugin that helps you fully style your `<select>` elements, and keeps them readable and accessible to all.
Selectbox is a simple and flexible jQuery plugin that helps you fully style your <select> elements, and keeps them readable and accessible to all.
Simply download the plugin through npm or bower. You can then use it with your favorite environment (the plugin supports CommonJS, AMD and global jQuery).
// CommonJS
var $ = require('jquery');
require('selectbox');
$('select').selectbox();
// AMD
require(['jquery', 'selectbox'], function($) {
$('select').selectbox();
});
// Global (include both jquery and selectbox JS files in your html)
$('select').selectbox();
You can then style the generated elements (see the examples for basic styling).
default : false
You can switch it to true to insert the options' labels and option groups' labels as html instead of plain text (be careful of injections !). You can add a data-original-label attribute on the options to use as a new label.
A function that takes the option jQuery object as a parameter and must return a string that will be injected as the option or option group label.
default : 'min-width'
Tells selectbox which CSS property it should use to set the select width : min-width or width. Use "manual" if you want to set the width with CSS.
default : true Tells selectbox to switch between two rendering modes depending on the viewport's width.
default : 768 Under this viewport's width, selectbox will switch to mobile display of the options' list.
default : 'toggle' The animation function to use when selectbox is in desktop mode. (see animation section).
default : 'mobile' The animation function to use when selectbox is in mobile mode. (see animation section).
default : null
If specified, it will be displayed on top of the options' list. If not, selectbox will retrieve the <label> associated with the source <select> element.
default : 'Cancel' The label of the cancel button that closes the options list.
default : 'selectbox'
default : 'selectbox-button'
default : 'selectbox-list-box'
default : 'selectbox-list'
default : 'selectbox-list-item'
default : 'selectbox-group-label'
default : 'selectbox-group-item'
default : 'selectbox-list-divider'
default : 'selectbox-items-title'
default : 'selectbox-cancel'
The API can be called through the plugin, or by retrieving it with the jQuery data() method.
// with the plugin
$element.selectbox('method_name', {params});
// with the data
var api = $element.data('selectbox');
api.method_name(params);
Opens the options list.
Closes the options list.
Sets the value of the select.
Disables the select.
Enables the select.
Returns if the select is disabled.
Updates all options and option groups. To call when the source <select> has changed.
Changes the settings and then refresh the selectbox.
Removes the plugin and restore the source <select>.
When using the API through the data method, you can access these properties.
The list of the selectbox settings.
The source <select>.
Selectbox comes with two default animations : 'toggle' and 'mobile'. Those reproduce basic rendering of a native <select> element.
You can also create your own function to call when opening or closing the selectbox, and pass them through options (see above).
$('select').selectbox({
desktopAnimation: function($selectbox, api, show) {
// Code here
},
mobileAnimation: function($selectbox, api, show) {
// Code here
}
});
$selectbox refers to the main selectbox container as a jQuery object, show is a boolean (true if the selectbox is opening, false if it's closing), and see above for what you can access from the api parameter.
If you need to store the function, you can add it to the $.fn.selectbox.animations, and refers to it through its name when passing options.
$.fn.selectbox.animations.customAnimation = function($selectbox, api, show) {
// Code here
};
$('select').selectbox({
desktopAnimation: 'customAnimation'
});
FAQs
Selectbox is a simple and flexible jQuery plugin that helps you fully style your `<select>` elements, and keeps them readable and accessible to all.
We found that selectbox demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.