Input Placeholder text becoming input value when hiding and showing elements in angularjs view using IE

☆樱花仙子☆ 提交于 2020-01-13 19:12:09

问题


We have inputs with placeholders like this:

<input placeholder="Search..." type="text" />

Everything is fine in chrome/firefox, but in IE sometimes when we are hiding and showing the element, the placeholder becomes the input value -- you click on the input and your cursor is after the 3 dots of "Search...(blinking cursor here)"

The inputs are in an angularJS ngView and we use ngShow and ngHide to show/hide them based on various logic.

When the view first renders you can click in the input and it removes the placeholder as expected, but after the input is hidden and then shown once or twice the problem starts.


We have even tried recreating the browsers html5 placeholder behaviour with javascript, binding to its blur/focus events and using the inputs value but we actually get the same behavior attempting doing them that way too.

We originally tried to use a placeholder.js thinking it was related to IE 8 or less not being great with html5... but we get this issue in up to IE11 as well.

来源:https://stackoverflow.com/questions/27515082/input-placeholder-text-becoming-input-value-when-hiding-and-showing-elements-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!