2

The following code is in a while loop, with values from the database. I am storing these values in custom data attributes for jQuery.

<div class='pending-information' data-id='$id' data-pid='$position' data-sid='$sid' data-image='$image' data-counter='$counter' data-start='$start'></div>

What is the professional approach? This method won't be valid in XHTML1. So whats the common method for storing attributes/values for jQuery?

user892134
  • 3,078
  • 16
  • 62
  • 128
  • This is the way to do it in HTML5 which is successor to both HTML4 and XHTML. So, why bother to make it XHTML conform? – Paul Apr 12 '12 at 10:09

1 Answers1

4

What is the professional approach?

Exactly what you are doing - data-* attributes are common way to do this.

This method won't be valid in XHTML1

So what? XHTML is not going to be extended into a new version - it is HTML 5 from now on and data-* attributes are the way to go.

Oded
  • 489,969
  • 99
  • 883
  • 1,009