Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor Server App $(document).ready() equivalent

$
0
0

I have a Blazor Server app, I need to run a js function when the document is loaded - when I use "Static" mode, jQuery $(document).ready() works fine but I need to use "ServerPrerendered" mode - when user click different link on the navbar, the $(document).ready() never fires because Blazor is using SingalR to update the content. The suggested way to do that is to use JSRuntime.InvokeVoidAsync("jsfunctiont") insideOnAfterRenderAsync of defaultLayout.razor but the problem is this event happens before all sub-components are fully rendered so my js function will fail.My question is what is the way to invoke js function after all sub-components are fully rendered? which is equivalent to $(document).ready() in Blazor server app using "ServerPreRendered" mode?

Thanks a million!


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>