Input Placeholder text becoming input value when h

2019-05-23 03:53发布

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.

0条回答
登录 后发表回答