HTML5 custom data attributes in Drupal I want to use the "data" attribute in some of my tags, and I have been searching for a way to include it. 

For Example: I am adding JavaScript code to my form. I use hook_form_alter() and the #attached property.

$path = drupal_get_path('module', 'mymodule');
$form['#attached']['js'][] = array('data' =&gt; $path . '/js/custom_values.js','type' =&gt; 'file');


How do I add a "data" attribute to the &lt;script&gt; tag generated? I want to use it for arguments to the JavaScript code.
If you mean how to add the data- attribute to the &lt;form&gt; tag it would be as easy as this:

$form['#attributes']['data-foo'] = 'bar';


The same goes for any element within the form:

$form['foo']['#attributes']['data-bar'] = 'baz';


For more info have a look at the documentation for #attributes.