Alternative to id selectors using tooltip in material design lite

Viewed 465

I am planning on using repeatedly a list of tooltips on the same page. Since the id selector is unique I would prefer to use an alternative selector like a class to apply one tooltip on multiple elements, instead of creating duplicate tooltips just so I can match the id. Example:

<p><span class="desc-mdl">MDL</span> is a great tool allowing web 
developers focusing on the code rather than dealing with design. 
<span class="desc-mdl">MDL</span> applies 
<span class="desc-css">CSS</span> and JavaScript to 
<span class="desc-html">HTML</span> elements. But is still provides 
enough freedom for a personal touch for the web page.</p>

<div class="mdl-tooltip" for="desc-mdl">Material Design Light</div>
<div class="mdl-tooltip" for="desc-css">Cascading Style Sheets</div>
<div class="mdl-tooltip" for="desc-html">Hyper Text Markup Language</div>

I know that for is reserved for ids but there has to be an alternative we can use avoiding creating hundreds of duplicate tooltips.

1 Answers
Related