Shakti
Shakti

Reputation: 218

data-description use on href link

I want to use data-description on href link like, but description not displaying. Is some one know how to use it then please let me know. Here is the demo link http://jsfiddle.net/KNa3A/

Upvotes: 0

Views: 1325

Answers (2)

SpaceBeers
SpaceBeers

Reputation: 13947

You can use the :after psuedo element for this - http://jsfiddle.net/spacebeers/KNa3A/4/

.your_class:after {
    content: attr(data-description);
    display: block;
    padding: 0 0 0 10px;
    color: red;
}

Set the content of the :after element to attr(data-description) and you're off.

Upvotes: 2

Tadeck
Tadeck

Reputation: 137380

You have no JavaScript code there except standard Mootools library: http://jsfiddle.net/KNa3A/

data-description could be used by some JavaScript plugin, but you need to initialize it. That plugin (possibly jQuery or Mootools plugin) will then get that description and render nice thing (popover, tooltip, whatever). This should be included in that specific plugin's tutorial / quickstart / readme file.

Ps. Others suggest to use title attribute instead. That is good way to do it, unless you want something fancy. But for something fancy you will most likely need JS plugin.

Upvotes: 0

Related Questions