Custom attribute in views fields I am trying to add custom attribute with elements like "data-url" and "data-text" in views fields, it shows something like "data-text="test text"> as output on front end.
How can i add them so that they work as attribute and not print as text ?
It's not initially obvious where and how to make these changes, fortunately it's not too hard to rewrite the output of the fields in views. 

You can make a new views template fields from the display:

Other &gt; Theme:Information link

Then edit the code adding your HTML around the Php and dropping it into your theme templates folder.

Or another way which I find is a lot quicker especially when there is a lot of changes going on in a development of a site, use the global custom text field or write the content fields.

I will use the title field to add an attribute as an example for you to follow.

In your view: 

*edit Fields &gt; title*

*Rewrite results &gt;* tick *Rewrite the output of this field*


In the text field add the following code using the tokens options provided and editing your HTML to your requirements.

&lt;h2 class"yourclass" data-text="test text"&gt;[title]&lt;/h2&gt;


Save the view and you will see your attributes in your Views display.

To add to this if you use the field Global text you can hide each of your fields then rewrite the HTML to whatever you need to, adding HTML for each token in the row.