this.options.tipText = this.options.tipText || this.$element.attr('title');
this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId);
- this.template.appendTo(document.body)
- .text(this.options.tipText)
- .hide();
+ if(this.options.allowHtml) {
+ this.template.appendTo(document.body)
+ .html(this.options.tipText)
+ .hide();
+ } else {
+ this.template.appendTo(document.body)
+ .text(this.options.tipText)
+ .hide();
+ }
this.$element.attr({
'title': '',
* @function
*/
destroy() {
- this.$element.attr('title', this.template.text())
+ var oldText = this.options.allowHtml ? this.template.html() : this.options.text();
+ this.$element.attr('title', oldText)
.off('.zf.trigger .zf.tootip')
// .removeClass('has-tip')
.removeAttr('aria-describedby')
Tooltip.defaults = {
disableForTouch: false,
+ /**
+ * Allow html content in tooltip (Unsafe if user generated)
+ * @example false
+ */
+ allowHtml: false,
/**
* Time, in ms, before a tooltip should open on hover.
* @option
// Window exports
Foundation.plugin(Tooltip, 'Tooltip');
-}(jQuery);
\ No newline at end of file
+}(jQuery);