Skip to content

Commit

Permalink
Add prefix/suffix support for <optgroup> (issue #8)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Doan committed Apr 16, 2018
1 parent e429521 commit 8d257fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ $dropdown.refresh();

## Data Attributes

The `data-prefix` and `data-suffix` attributes can be added to the `<option>` elements to insert custom HTML before and after each menu item, respectively. You can make use of these attributes to add icons, thumbnails, badges, etc. to the menu items. A good example can be seen [in the demo](https://thdoan.github.io/pretty-dropdowns/demo.html#example3).
The `data-prefix` and `data-suffix` attributes can be added to the `<option>` and `<optgroup>` elements to insert custom HTML before and after each menu item or menu group label, respectively. You can make use of these attributes to add icons, thumbnails, badges, etc. to the menu items. A good example can be seen [in the demo](https://thdoan.github.io/pretty-dropdowns/demo.html#example3).

## Keyboard Navigation

Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pretty-dropdowns",
"description": "A simple, lightweight jQuery plugin to create stylized drop-down menus.",
"version": "4.11.0",
"version": "4.12.0",
"main": [
"dist/css/prettydropdowns.css",
"dist/js/jquery.prettydropdowns.js"
Expand All @@ -22,9 +22,9 @@
"select"
],
"authors": [
"T. H. Doan <[email protected]> (http://www.tohodo.com/)"
"T. H. Doan <[email protected]> (http://www.tohodo.com)"
],
"homepage": "http://thdoan.github.io/pretty-dropdowns/",
"homepage": "https://thdoan.github.io/pretty-dropdowns/",
"repository": {
"type": "git",
"url": "git://github.com/thdoan/pretty-dropdowns.git"
Expand Down
7 changes: 3 additions & 4 deletions dist/js/jquery.prettydropdowns.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*!
* jQuery Pretty Dropdowns Plugin v4.11.0 by T. H. Doan (http://thdoan.github.io/pretty-dropdowns/)
* jQuery Pretty Dropdowns Plugin v4.12.0 by T. H. Doan (https://thdoan.github.io/pretty-dropdowns/)
*
* jQuery Pretty Dropdowns by T. H. Doan is licensed under the MIT License.
* Read a copy of the license in the LICENSE file or at
* http://choosealicense.com/licenses/mit
* Read a copy of the license in the LICENSE file or at https://choosealicense.com/licenses/mit/
*/

(function($) {
Expand Down Expand Up @@ -377,7 +376,7 @@
break;
case 'OPTGROUP':
sClass += ' label';
sText = elOpt.getAttribute('label');
sText = (elOpt.getAttribute('data-prefix') || '') + elOpt.getAttribute('label') + (elOpt.getAttribute('data-suffix') || '');
break;
}
if (elOpt.disabled || (sGroup && elOpt.parentNode.disabled)) sClass += ' disabled';
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pretty-dropdowns",
"version": "4.11.0",
"version": "4.12.0",
"description": "A simple, lightweight jQuery plugin to create stylized drop-down menus.",
"keywords": [
"jquery-plugin",
Expand All @@ -10,12 +10,12 @@
"drop-down menu",
"select"
],
"homepage": "http://thdoan.github.io/pretty-dropdowns/",
"homepage": "https://thdoan.github.io/pretty-dropdowns/",
"bugs": {
"url": "https://github.com/thdoan/pretty-dropdowns/issues"
},
"license": "MIT",
"author": "T. H. Doan <[email protected]> (http://www.tohodo.com/)",
"author": "T. H. Doan <[email protected]> (http://www.tohodo.com)",
"main": "dist/js/jquery.prettydropdowns.js",
"dependencies": {
"jquery": ">=1.7.0"
Expand Down

0 comments on commit 8d257fa

Please sign in to comment.