C
C#7mo ago
skyslide22

Net8 Blazor onclick="js()" Not Working

i have a button with enhance navigation set to false but the blazor.web.js still fires and replaces my dom manipulations with the result from the server the onclick is not working, blazot replaces the element instantly after js manipulation i can see that in the network tab in the chrome dev tools how can i disable that stuff?
<a href="#ateam" data-enhance-nav="false" class="btn read-more-cta" onclick="this.style.display='none';">
Read more
@* <i class="fa fa-arrow-down"></i> *@
<i class="fa-regular fa-chevrons-down"></i>
</a>
<a href="#ateam" data-enhance-nav="false" class="btn read-more-cta" onclick="this.style.display='none';">
Read more
@* <i class="fa fa-arrow-down"></i> *@
<i class="fa-regular fa-chevrons-down"></i>
</a>
2 Replies
McBeth
McBeth7mo ago
in the anchor tag simply write diseable
skyslide22
skyslide227mo ago
that does not fix it this is the page header
@page "/"
@attribute [StreamRendering(false)]
<PageTitle>Home</PageTitle>
@page "/"
@attribute [StreamRendering(false)]
<PageTitle>Home</PageTitle>
nvm found fix
<script src="_framework/blazor.web.js" autostart="false"></script>
<script>
Blazor.start({
ssr: { disableDomPreservation: true }
});
</script>
<script src="_framework/blazor.web.js" autostart="false"></script>
<script>
Blazor.start({
ssr: { disableDomPreservation: true }
});
</script>