Skip to content

Commit f880e85

Browse files
copy select element's classes
In case of you want to add some extra classes to customSelect div, I modified the code accordingly. It copies all classes of the select element and appends those to customSelect div.
1 parent 8d07ef2 commit f880e85

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

js/SelectBox.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@
7878
cfg.selectbox.addClass("use-default");
7979
}
8080

81-
var selectId = "";
81+
var selectId = "",
82+
selectedClass = cfg.selectbox.attr("class");
83+
8284
if(typeof cfg.selectbox.attr("id") !== "undefined") {
8385
selectId = 'id="select-'+cfg.selectbox.attr("id")+'"';
8486
}
85-
cfg.selectbox.wrap('<div class="customSelect" '+selectId+' />');
87+
88+
cfg.selectbox.wrap('<div class="customSelect '+selectedClass+'" '+selectId+' />');
8689

8790
$customSelect = cfg.selectbox.parents(".customSelect");
8891
$options = cfg.selectbox.find("option");

0 commit comments

Comments
 (0)