I am implementing an HTML5 like error tooltip using Bootstrap popover. Like the HTML5 version, I would like to apply an offset to tooltip so it shifts to the right. Try as I may, I have not been able to accomplish this.
I have tried several the templating approaches with no success. The Bootstrap Popover document shows "offset" as an option and points to a cryptic Tether document. Adding the offset option (ex. offset: '0 25%') does not seem to work either.
validate.issueError = function ($elem, msg, placement) {
placement = placement == undefined ? 'bottom' : placement;
var offset = $elem.width() / 4;
var template = '<div class="popover" style="position:relative; margin-left:' + offset + 'px" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
console.log("template="+ template)
$elem.prop('data-toggle=popover', true);
var exclamationPoint = "<span style='font-weight: bold; font-size:medium; color: white; background-color: orange; height: 12px; padding: 1px 8px; margin-right: 8px;'>!</span>";
var content = "<span style='font-size: smaller;'>" + msg + "</span>";
$elem.popover("destroy").popover({
html: true,
placement: placement,
template: template,
content: exclamationPoint + content
}).popover('show');
setTimeout(function () { $elem.popover('hide') }, 5000);
$elem.focus();
$elem.on("keydown click", function () {
console.log("kd?")
$(this).popover('hide');
})
}