/ Published in: HTML

Generic function to test whether and element supports a particular element in HTML5.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function checkAttribute(element, attribute) { var test = document.createElement(element); if (attribute in test) { return true; } else { return false; } } //usage if (!checkAttribute('input', 'placeholder')) { }
Comments
