Select or Die – Style Select Box Elements Of Your PHP Website

In my previous tutorial we saw about styling Select Box using CSS. For more details on that, kindly click here. That process is slightly tedious as we have to write CSS code for each every customization. To overcome these programming hurdles, there is one JQuery plugin available which have emerged as a saviour to all JavaScript developers. “SELECT OR DIE” is a JQuery plugin to style <select> elements. Let’s see in this tutorial how to use “Select or Die” plugin.

How to Use?

This jQuery plugin SELECT OR DIE comes with one stylesheet file called “selectordie.css” and one JavaScript file called “selectordie.min.js”. We have to include the correct version of the jQuery to work with this plugin. Below is the easy-to-understand description on the usage of this plugin.

Apply the plugin to select box element

1

$("select").selectOrDie();

Add custom class/ID

1

2

3

4

$("select").selectOrDie({

customClass:"yourcustomclass",

customID:"yourcustomID"

});

Or you can directly bind them in the select box inline (this way is applicable to all options).