Reputation: 1582
I have two select box, each having different reponsive width.
width:45%
and width:22%
. How to use jquery chosen for both elements.
In my project many components have width:45%
only few are 22%
.
I am using 22%
inline with html like
<div style='width:22%'></div>
If I use
$("select").chosen({ width: '45%' });
SOURCE : Chosen harvesthq resize width dynamically
The above div
width value also gets changed. Please help.
Upvotes: 1
Views: 1959
Reputation: 13
step-0: remove all width
step-1: add these lines to your js file:
var callback = function (){
$('.chosen-container.chosen-container-single').innerWidth("100%");
}; $(document).ready(callback);
$(window).resize(callback);//responsive width
Upvotes: 1