Solution 1 :

You can try something like below where you set the color as data attribute of the link element.

$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})

$('[data-toggle="tooltip"]').on('inserted.bs.tooltip', function () {
  var c = $(this).data("color");
  $('.tooltip span').css('color',c);
})
a {
 margin:50px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm" crossorigin="anonymous"></script>

<a href="#" title="" data-toggle="tooltip" data-html="true" data-original-title="1 bookmark<br/>Category: <span >Red</span>" data-color='#FF9AA2' aria-describedby="tooltip92967">My Tooltip Demo</a>

<a href="#" title="" data-toggle="tooltip" data-html="true" data-original-title="1 bookmark<br/>Category: <span >green</span>" data-color='#00FF22' aria-describedby="tooltip92967">another Tooltip Demo</a>

Reference: https://getbootstrap.com/docs/4.4/components/tooltips/#events

Problem :

I’ve got the follwing HTML:

<a href="#" title="" data-toggle="tooltip" data-html="true" data-original-title="1 bookmark<br/>Category: <span style=&quot;color: #FF9AA2&quot;>Red</span>" aria-describedby="tooltip92967">My Tooltip Demo</a>

The bootstrap tooltip display correctly, apart from the color of the span changing to red. How can I style the span so that it applies the color inside the tool tip? All the text is the standard white of the bootstrap tooltips.

Comments

Comment posted by Chud37

Unfortunately that won’t help as I need to set the span colour on the fly for each href.

Comment posted by Temani Afif

@Chud37 the color is set

Comment posted by Chud37

Oh i see, sorry I didn’t the whole answer on my mobile. I’ll give it a go.

By