What is the simplest way to customize the jquery ui selectmenu button icon (not the dropdown icons) with a custom icon NOT defined by default in the jQuery UI CSS Framework.
I see many examples for customizing jquery ui button icons using CSS, but not the selectmenu button icon.
<!doctype html>
<html lang="en">
<head>
<title>SelectMenu Button Test</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
$(function() {
$( "#buttonone" ).selectmenu({ icons: { button: "ui-icon-triangle-2-n-s" } });
//Replace with custom selectmenu button icon
$( "#buttontwo" ).selectmenu({ icons: { button: "ui-icon-triangle-1-s" } });
//Replace with a second custom selectmenu button icon
});
</script>
</head>
<body>
<select name="buttonone" id="buttonone">
<option>All fields</option>
<option>Field one</option>
<option>Field two</option>
</select>
<select name="buttontwo" id="buttontwo">
<option>All options</option>
<option>Option one</option>
<option>Option two</option>
</select>
</body>
</html>
Yes, you can easily use custom styling on a button by supplying a custom class name, like this:
$( "#selectId" ).selectmenu({ icons: { button: "custom-icon" } });
Then you just add styling rules to your CSS for that class, like this:
.ui-state-default .ui-icon.custom-icon {
background-image: url([your custom image]);
}
Simple JSFiddle example: http://jsfiddle.net/CaseyRule/f7q8sp43/1/