Skip to content

Instantly share code, notes, and snippets.

@norberttech
Created January 14, 2013 20:46
Show Gist options
  • Save norberttech/4533266 to your computer and use it in GitHub Desktop.
Save norberttech/4533266 to your computer and use it in GitHub Desktop.
Placeholder.js fast usage.
window.onload = function() {
var form = document.getElementById('form'),
placeholderTestElm = document.createElement('input'),
isSupported = !(undefined === placeholderTestElm.placeholder);
if (!isSupported) {
this.initPlaceholder();
form.onsubmit = function(e) {
alert('After this point all inputs without values and with placeholder should be clear.');
}
} else {
alert('Sorry but the browser you are currently using have native placeholder support implemented. Try with older one.')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment