views:

17

answers:

2

Hi, i have to insert an id reference in a div. i've create an rif attribute:

 <div rif="5" id="25km" class="mini_button_form">25km</div>

but this is w3c invalid.

How can i do it?

+1  A: 

"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")." (http://www.w3.org/TR/html401/types.html#type-name)

Konrad Garus
A: 

It depends on your doctype. For HTML5, I'd recommend changing it to:

<div data-rif="5" id="km25" class="mini_button_form">25km</div>

If it has to be (X)HTML4 then you could put the data in the class attribute and use something like the jQuery Metadata plugin.

<div id="km25" class="mini_button_form { rif:5 }">25km</div>

(Note I changed the ID's too, as Konrad suggested)

dave1010