Skip to content

Commit e093745

Browse files
author
Michael
committed
Fix #564
Tentatively adding support for images. Adding an attribute `data-image-src` to the option element with the image source url will pull that image into the menu next to that check box.
1 parent a5f3e0c commit e093745

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

jquery.multiselect.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
.ui-multiselect-checkboxes { overflow-y:auto; position:relative; }
1616
.ui-multiselect-checkboxes label { border:1px solid transparent; cursor:default; display:block; padding:3px 1px; }
1717
.ui-multiselect-checkboxes label input { position:relative; top:1px }
18+
.ui-multiselect-checkboxes label img { height: 30px; vertical-align: middle; padding-right: 3px;}
1819
.ui-multiselect-checkboxes li { clear:both; font-size:0.9em; list-style: none; padding-right:3px; }
1920
.ui-multiselect-checkboxes .ui-multiselect-optgroup { padding: 3px; }
2021
.ui-multiselect-columns { display: inline-block; vertical-align: top; }

src/jquery.multiselect.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@
194194
"aria-disabled": isDisabled ? "true" : null
195195
}).data($(option).data()).appendTo($label);
196196

197-
$("<span/>").text($(option).text()).appendTo($label);
197+
var $span = $("<span/>").text($(option).text());
198+
if($input.data("image-src")) {
199+
$span.prepend($("<img/>").attr({"src": $input.data("image-src")}));
200+
}
201+
$span.appendTo($label);
198202

199203
return $item;
200204
},

0 commit comments

Comments
 (0)