如何防止标签更改

时间:2017-02-12 18:35:37

标签: javascript twitter-bootstrap asp.net-mvc-4 nav preventdefault

我能够进入它调用的函数,并且我返回false但是标签仍然会切换?对我做错了什么想法?

Private Sub webMailNavigating(sender As Object, e As WebBrowserNavigatingEventArgs) Handles webMail.Navigating

    ' opens link in new tab if it isn't blank and will not open emails in a new tab.
    Try
        If Not e.Url.ToString.Contains("emailUrl") And Not e.Url.ToString.Contains("about:blank") Then
            e.Cancel = True
            Process.Start(e.Url.ToString)

        Else

        End If

    Catch

    End Try
End Sub

1 个答案:

答案 0 :(得分:0)

好吧,这真的很愚蠢,我现在使用显示而不是显示它正在工作......

 $(document).on('show.bs.tab', 'a[data-toggle="tab"]', function (event) {

        debugger;
        var isValidationValid = templateInstance.validateScreen();

        if(isValidationValid)
        {
            localStorage.setItem('activeTab', $(event.target).attr('href'));
            $(event.target).attr("href");
            return true;
        }
        else {

            event.preventDefault();
              return false;

        }


    });