C
C#8mo ago
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?
5 Replies
PontiacGTX
PontiacGTX8mo ago
what does it show when you print console.log(new bootstrap(element,{})) if nothign or an error maybe the order the scripts are included matter
abc
abc8mo ago
thats a good debug idea
abc
abc8mo ago
No description
abc
abc8mo ago
No description
abc
abc8mo ago
this may be the problem but idk how to fix it something is rendering, because the vscroll gets bigger but i cant tell what its rendering in the bottom left corner what the fuc
Want results from more Discord servers?
Add your server
More Posts
Need help structuring a class library for internal toolsHi there, I'm working on creating an internal tool for exposing some commonly used functionality thaXML Serialization: How to serialize a property with a null value without xsi:nill attribute?I have a property the following code: ` [Serializable()] public class MyClass { UserControl issue - UC2 doesn't appear after closing UC1Hello, I started learning about almost a week ago and the past day or two this problem has been buggCompile for i mac osHow do i compile my avalonia app for mac os. the docs are really confusing for me to understand. I aIm trying to open another program but my code isn't workingI made a login system. If login info is correct another program will open if its not it will tell wrCorrect environments handling (appSettings.json)We are using azure DevOps and I wondered what's the best way to handle environments. Option 1: keep Can someone explain how I use MQTTnet and how MQTT in general works?MQTTnet: https://github.com/dotnet/MQTTnet Help would be really appreciated, thank you :)Can't call C++ function in Unity through mono_add_internal_call, with a MissingMethodExceptionthis is my question detail on stackoverflow: https://stackoverflow.com/questions/77478866/how-to-useIssues deserializing data using System.Text.Json when object fields are not known at runtime.I have a bit of an interesting problem deserializing from an external API using System.Text.Json. OnCan someone explain to me how this works``` public bool EliminarClienteXML(BE_Cliente cliente) { acceso = new DatosXML()