JavaScript: Alternative method for HTML 5 Data Attribute in Old Browsers

The HTML5 datalist property is not available in older browsers (it can be polyfilled easily enough though).

The standard getAttribute method can be used instead of course, and data-xxx attributes on HTML elements are accepted by all browsers, IE also has supported this method from IE4.

Sample HTML

JavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA