Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placeholder is not shown after rerendering in the react component #73

Open
captainkovalsky opened this issue Jun 6, 2016 · 1 comment

Comments

@captainkovalsky
Copy link

I've found this issue in the project. How can I run again placeholders in the didUpdate method? Has this lib an api?

@ginader
Copy link
Owner

ginader commented Jun 6, 2016

If you want to run the placeholder polyfill always (no matter if the browser natively supports it or not) the you can simply run: $('input[placeholder], textarea[placeholder]').placeHolder();

If you want to use the native Browser implementation when it's available then do the following:

 $(function(){
    var config = window.placeHolderConfig || {};
    if(('placeholder' in $('<input>')[0] || 'placeHolder' in $('<input>')[0]) && !config.forceApply){
         // don't run the polyfill when the browser has native support
        return;
    }
    $('input[placeholder], textarea[placeholder]').placeHolder();
});

Hope it helps :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants