Placeholders.js icon indicating copy to clipboard operation
Placeholders.js copied to clipboard

IE9 and IE8 page refresh leaves input fields blank until clicked into/out

Open alexagat opened this issue 11 years ago • 14 comments

When I load a page fresh in IE9/IE8 the script works fine and displays placeholders. If I refresh the page after it has loaded, the input fields are blank until I click into and out of them.

Has anybody else noticed this? Fix out there?

I

alexagat avatar Jan 27 '14 18:01 alexagat

https://github.com/mathiasbynens/jquery-placeholder doesn't experience the issue detailed above.

alexagat avatar Jan 27 '14 18:01 alexagat

Yeah I've got the same issue. Nothing till the input is clicked on and loses focus.

spacebeers avatar Apr 25 '14 10:04 spacebeers

I don't know what causes this. I can reproduce it but no idea on a fix yet. Will look into it further when I get a chance. If anyone else has any thoughts a PR would be welcome ;)

jamesallardice avatar Apr 25 '14 11:04 jamesallardice

If changes to the page are made (comment out a block of HTML) and then refresh, the placeholders come back. Refreshing again, with no changes made to the HTML, causes them to break again.

acarr avatar Jun 16 '14 15:06 acarr

I'm getting this issue in IE9 as well. Was there a solution?

figfig avatar Jul 26 '14 13:07 figfig

After 6 months, looks like the best solution is to use a library like the one I linked to above that doesn't experience this issue.

alexagat avatar Jul 26 '14 18:07 alexagat

Hi guys,

Has there been any progress on this fix?

Ive tried using the library mentioned above but that only served to amplify the amount of empty placeholders.

Oregand avatar Nov 27 '14 22:11 Oregand

One fix would be to briefly give focus to all inputs and textareas when the page loads.

So, using the jQuery, it would be something like: $("input,textarea").focus().blur();

That would make the page scroll, so if you have all the content in a container, you should also temporarily make that position: fixed; to prevent the page from scrolling.

Have tested this approach and it seems to work both in IE8 and IE9.

verde-io avatar Dec 04 '14 16:12 verde-io

I have the same issue: v3.1.0 (jamesallardice/Placeholders.js#v3.1.0)

xtreemrage avatar Feb 02 '15 09:02 xtreemrage

I was able to resolve this by calling Placeholders.enable() after dynamically creating additional <input> elements. You could try something like this on page load:

window.setTimeout(function() {
    Placeholders.enable();
}, 100);

mike-zarandona avatar Jun 30 '15 18:06 mike-zarandona

I'm also experiencing this. It seems like the browser is trying to be helpful and repopulating the form after refresh. In my tests, if I populate a form element this element is preserved. It seems like the other elements may be getting repopulated with empty string.

fantapop avatar Jul 29 '15 23:07 fantapop

Ditto on @mike-zarandona solution, seems to do the trick for me.

gregkerzhner avatar Aug 06 '15 00:08 gregkerzhner

Looks like same issue https://github.com/jamesallardice/Placeholders.js/issues/54

theaspect avatar Oct 16 '15 11:10 theaspect

It works! Thanks! @mike-zarandona

youngwind avatar Feb 23 '16 09:02 youngwind