import( 'de.ceus-media.ui.html.Options' );
$box = new UI_HTML_Options( 'example' );
$box->setUrl( './data.php5' );
$box->setDefaultItem( '', '- select -' );
$box->setSelectedItem( '1' );
$html = $box->buildCode();
$script = $box->buildScript();
<select id="example" name="example" class="cmOptions"><option value="" selected="selected">- select -</option></select>
jQuery(document).ready(function(){
jQuery("select[name='example']").ajaxOptions({"url":".\/data.php5","async":true,"cache":true,"data":[],"selected":null}).show();
});
{
"status": "data",
"data": [
{
"id": 1,
"label": "Item 1"
}, {
...
"id": 4,
"label": "Item 4"
}
]
}
After loading jQuery you need to include the plugin and optional other used plugins.
For optical effects you can load the given plugin style.
<script type="text/javascript" src="//js.ceusmedia.com/jquery/cmOptions/0.3.js"></script>
<script type="text/javascript" src="//js.ceusmedia.com/jquery/color.js"></script>
<script type="text/javascript" src="//js.ceusmedia.com/jquery/cmBlitz/0.1.js"></script>
<link rel="stylesheet" type="text/css" href="//js.ceusmedia.com/jquery/cmOptions/0.3.css"/>