© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
11 replies
abc

Blazor JS Interop - Bootstrap 5 Tooltip

Hey.
I want to use the Bootstrap 5 Tooltip on divs.
i have a site.js that has this func

function tooltip(id) {
    var element = document.getElementById(id);
    var tooltip = new bootstrap.Tooltip(element, {});
}
function tooltip(id) {
    var element = document.getElementById(id);
    var tooltip = new bootstrap.Tooltip(element, {});
}


my blazor looks like this
<div id="submit" data-bs-toggle="tooltip" data-bs-title="Submit your data!">
  <MyPrimaryButton OnClick="Submit">@Localizer["Submit"]</MyPrimaryButton>
</div>
<div id="submit" data-bs-toggle="tooltip" data-bs-title="Submit your data!">
  <MyPrimaryButton OnClick="Submit">@Localizer["Submit"]</MyPrimaryButton>
</div>

protected override async Task OnAfterRenderAsync(bool firstRender)
{
  if(firstRender)
  {
       await JSRuntime!.InvokeVoidAsync("tooltip", "submit");
  }
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
  if(firstRender)
  {
       await JSRuntime!.InvokeVoidAsync("tooltip", "submit");
  }
}


if i put alerts in the JS, those get triggered. but the tooltip doesnt render. any ideas?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Blazor JS Interop - Return RTCPeerConnection from js to Blazor in order to close it
C#CC# / help
4y ago
Configure JsonSerializationOptions for WASM Interop in Blazor?
C#CC# / help
9mo ago
Blazor Server, Bootstrap modal, dismiss after validation
C#CC# / help
4y ago
Blazor vs react(NEXT.js)
C#CC# / help
4mo ago