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

Override native IE10+ placeholder behavior, disappearing text on focus #204

Closed danielHalan closed 9 years ago

danielHalan commented 10 years ago

modern IE native placeholder feature clears the text on Focus, which isnt so good when using JS to pre-select a textbox.

Is there a way to override this behavior? if not, would be a nice feature.

mikealmond commented 9 years ago

:+1: I'd love to see this as well.

jonathantower commented 9 years ago

:+1: Yes, this would be very helpful. Anyone managed to do this already?

amerikan commented 9 years ago

Seems like it's a bug in IE10:

I can see this happening in IE 10 for their native placeholder implementation. Haven't tried it in IE11 yet.

What can be done is to force IE10 to actually use the plugin's functionality even though it supports it natively already. We would have to determine when a browser is IE 10.

danielHalan commented 9 years ago

Can verify that the bug still persists in latest IE11 (11.0.9600.17498)

amerikan commented 9 years ago

@danielHalan hmm. well we can add a option something like includeKeepOnFocus: true (the name probably needs more thought). With this option we can force IE 10/11 to use the plugin.

We need to find out how to determine if the user's browser is IE 10 or 11 to be able to do it. It would be best to determine it by using feature detection rather than by sniffing the browser's user agent. Any ideas?

amerikan commented 9 years ago

I'm going to say this is related to #92

gabskoro commented 9 years ago

Argh, I need this feature now :)

amerikan commented 9 years ago

Closing, duplicate of #92