How to add data attributes to view list  tags? I have a HTML-list view, which generates li tags for my content. I want to add a data- attribute to each list item dependent on the content. How to achieve this?
Override style output template file using theme information in views.....



Override file with below code..

&lt;?php

/**
 * @file
 * Default simple view template to display a list of rows.
 *
 * - $title : The title of this group of rows.  May be empty.
 * - $options['type'] will either be ul or ol.
 * @ingroup views_templates
 */
?&gt;
&lt;?php print $wrapper_prefix; ?&gt;
  &lt;?php if (!empty($title)) : ?&gt;
    &lt;h3&gt;&lt;?php print $title; ?&gt;&lt;/h3&gt;
  &lt;?php endif; ?&gt;
  &lt;?php print $list_type_prefix; ?&gt;
    &lt;?php foreach ($rows as $id =&gt; $row): ?&gt;
      &lt;li data-attr="" class="&lt;?php print $classes_array[$id]; ?&gt;"&gt;&lt;?php print $row; ?&gt;&lt;/li&gt;
    &lt;?php endforeach; ?&gt;
  &lt;?php print $list_type_suffix; ?&gt;
&lt;?php print $wrapper_suffix; ?&gt;