mathiasbynens / jquery-placeholder

A jQuery plugin that enables HTML5 placeholder behavior for browsers that aren’t trying hard enough yet
https://mths.be/placeholder
MIT License
3.98k stars 1.34k forks source link

Fix a bug in IE7 and IE8 #167

Closed o0x2a closed 10 years ago

o0x2a commented 11 years ago

untitled

When using selectize alongside jquery.placeholder, it adds the string 'undefined' when clicking on a selected value to change it. This is caused because the placeholder is set with an empty option inside select, then selectize turn this to an input element and set the proper placeholder attribute. It means an unnecessary placeholder event has been fired on an element which expected to have placeholder. This change fix this issue by checking if the value ofplaceholder attribute is valid before adding it to the input element. This good be an idea to implement placeholder support for select elements as it is conformed with w3c.

Pickachu commented 10 years ago

:+1: Fix works for me!

luccamordente commented 10 years ago

:+1:

mathiasbynens commented 10 years ago

This good be an idea to implement placeholder support for select elements as it is conformed with w3c.

<select placeholder> is non-standard and is not implemented anywhere either. The spec you linked to doesn’t mention it — it uses the word placeholder in a different context.