Skip to main content
added 52 characters in body; added 95 characters in body
Source Link
quentin-starin
  • 5.9k
  • 30
  • 27

Classes are ok, but I would consider HTML data attributes as well. Oftentimes, a class name simply doesn't convey enough information to enable the appropriate javascript hooking (without hard-coding element id names). HTML data attributes provide another way to classify and select elements and attach data to an elementthem for auxiliary purposes, like JavaScript-based enhancements.

With jQuery's, HTML data attributes are equally as simple to use as CSS classes.

Classes are ok, but I would consider HTML data attributes as well. Oftentimes, a class name simply doesn't convey enough information to enable the appropriate javascript hooking (without hard-coding element id names). HTML data attributes provide another way to attach data to an element for auxiliary purposes.

Classes are ok, but I would consider HTML data attributes as well. Oftentimes, a class name simply doesn't convey enough information to enable the appropriate javascript hooking (without hard-coding element id names). HTML data attributes provide another way to classify and select elements and attach data to them for auxiliary purposes, like JavaScript-based enhancements.

With jQuery's, HTML data attributes are equally as simple to use as CSS classes.

Source Link
quentin-starin
  • 5.9k
  • 30
  • 27

Classes are ok, but I would consider HTML data attributes as well. Oftentimes, a class name simply doesn't convey enough information to enable the appropriate javascript hooking (without hard-coding element id names). HTML data attributes provide another way to attach data to an element for auxiliary purposes.