nobleclem / jQuery-MultiSelect

Turn a multiselect list into a nice and easy to use list with checkboxes.
https://springstubbe.us/projects/jquery-multiselect/
MIT License
289 stars 216 forks source link

Issue with placeholder and placeholderTxt width #173

Closed odereur closed 2 years ago

odereur commented 4 years ago

Sometime the "# selected" text trigger without reason. It happened that my placeholder was 0.000001 less than my placeholderText.

To resolve my error i have updated the line 849 of "jquery.multiselect.js"

From : "else if( (placeholderTxt.width() > placeholder.width()) || (selOpts.length != selectVals.length) ) {" To : "else if (((Math.round(placeholderTxt.width() 100) / 100) > (Math.round(placeholder.width() 100) / 100)) || (selOpts.length != selectVals.length) ) {"

I hope it will be useful for you.

nobleclem commented 4 years ago

instead of the multiply and divide you can try using .toFixed(2). Should accomplish your goal. I will have to put some thought into if that adjustment is warranted. Need to run some test scenarios.