Live Chat Icon For mobile
Live Chat Icon

What if the Blazor anchor tag executes href instead of an onclick event?

Platform: Blazor| Category: Event handling

Yes, this is a known issue in Blazor. You can track the issue link on Github.

This is how to prevent an href in an anchor tag and call an onclick event. [Work Around]

<a href="" class="btn btn-primary" @onclick="@TheEvent"  @onclick:preventDefault>Do it</a>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.