Question: Placeholder plugin with Selectize on IE9 not working
I tried to put many Placeholder plugins with Selectize but one or the other problem is popped up while testing in IE9. Is there an issue or if it is already tried could you please let me know what is the fix?
Please create a http://jsfiddle.net/ to show the problem.
here is the fiddle
http://jsfiddle.net/chennakrishnaa/KQLu5/3/
Okay, so IE9- doesn't support the placeholder attribute. I would recommend that you use help text outside the element if you really need a description, but you could also just ignore it (like rounded corners not showing up in IE8, but newer browsers will show it). Otherwise you need to create your own placeholder library, since the placeholder libraries I can find will conflict with the way Selectize work.
Thanks for the response. Could you let me know where exactly it is conflicting? Meanwhile I will try to have my own placeholder solution.
Selectize does a lot of tricks to generate the functionality and flexibility. If you look at the code with Firebug/inspector after initializing selectize, you'll see some of the tricks.
The box looks like a input/select tag, but is actually a construction of a single <input> for typing and several <div>s for display.
The placeholder plugin you're using will actually fill the selectize <input> with placeholder text - that's probably the conflict (I guess).
I've just been playing around - the only way I can make it work-ish is with CSS - it's horrible code: http://jsfiddle.net/m447K/2/
In case someone still needs to support placeholders in IE8/9, here is how I managed to get it working with Placeholder Enhanced library.
var togglePlaceholderSupport = function() {
if (selectize.items.length > 0) {
// disable placeholder when there is more than one tag
selectize.$control_input.placeholderEnhanced('destroy');
// ensure the placeholder text is cleared
selectize.$control_input.val('');
} else {
// enable placeholder when no tags
selectize.$control_input.placeholderEnhanced({
normalize: false
});
}
};
// add placeholder support
togglePlaceholderSupport();
// check whether to enable/disable placeholder whenever selected items change
selectize.on('change', togglePlaceholderSupport);
// ensure selectize dropdown opens when input is focused
selectize.$control_input.on('focus', function() {
if (!selectize.$control_input.val()) {
selectize.open();
}
});
closing stale issues older than one year. If this issue was closed in error please message the maintainers. All issues must include a proper title, description, and examples.