I am manipulating the data-complete-text attribute of a link using jQuery. My code looks like this.
var complete = _self.attr("data-complete-text");
_self.attr("data-complete-text","<span class='symbol-done-tick'></span><span class='acheived-text'>"+complete+"</span>");
That is I am assigning html spans to this attribute to get the desired effect and it works fine. I mean, the spans get inserted properly but the CSS classes which I have specified in these spans don’t have any effect. I dunno why. Help me out.
If you’re trying to set the
data-complete-textso that Bootstrap’sButtonwill use it, after setting thedata-complete-textattribute you have to set the state of the button as well:The documentation (such as it is) doesn’t say it supports HTML there, but it seems to work in my test: Live Example | Source
HTML:
JavaScript:
In the above, the
fooclass on thespaninside thedata-complete-textworks when you set the button state to'complete'.