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

Simple.js testing for input placeholder #1

Open
smlombardi opened this issue Dec 10, 2013 · 1 comment
Open

Simple.js testing for input placeholder #1

smlombardi opened this issue Dec 10, 2013 · 1 comment

Comments

@smlombardi
Copy link

You can test if a placeholder is currently being displayed by checking the input.__placeholder property,

How, exactly? Can you please provide an example?

@kbjr
Copy link
Member

kbjr commented Dec 11, 2013

var elem = document.getElementsByTagName('input')[0];

if (elem.__placeholder == null) {
    // no placeholder is defined for this element (the polyfill is not initialized for this elem)
} else if (elem.__placeholder) {
    // placeholder text is being displayed
} else {
    // placeholder text is not being displayed
}

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