简体   繁体   中英

ASP.NET events not firing in <div> Tag

I have a tags that when you hover over another div tag containing the login and password form appears. But for some reasons the event is not firing. I put the same control outside of the hover and it can be fired.

At first i thought it was because of a drag-and-drop problem because my div could be dragged and placed in the textbox for the website link so i disabled drag-and-drop on my page but the problem doesn't go away.

The mouse cursor changes to the human finger cursor too when I hover over the div.

Here is the code on masterpage where nav-item is the cause:

                <div class="brick1" style="width: 33%">
                    <a href="" class="nav-item">
                        <div class="nav-hover">
                            <div class="loginbrick">
                                    <asp:ContentPlaceHolder ID="LoginPlaceHolder" runat="server">
                                    </asp:ContentPlaceHolder>
                            </div>
                        </div>
                        <i class="li_bulb"></i><span>Welcome, Hover over to login</span>
                    </a>
                </div>

Default.aspx's contentplaceholder:

<asp:Content ID="Content4" ContentPlaceHolderID="LoginPlaceHolder" runat="Server">
    <form id="AnonymousForm" runat="server">
    <asp:Label ID="Label1" runat="server" Text="UserName: " CssClass="aspTextView">        </asp:Label>
<asp:TextBox ID="tbUserName" runat="server" CssClass="aspTextBox" OnTextChanged="tbUserName_TextChanged"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Password: " CssClass="aspTextView"></asp:Label>
<asp:TextBox ID="tb_Password" runat="server" CssClass="aspTextBox"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Login" OnClick="Button1_Click" />
</form>
</asp:Content>

You are enclosing div.nav-hover and div.loginbrick in a hyperlink. Try what happens when you remove that.

in your html brow > brick1 in which your login form is placed.

On brick1 click all event are prevented..

So try to put your form out side brick1.

I am sure your button event is not fire bCoz of js

Checkout you have not added multiple form tag actually we have same problem. and i found issue was because of multiple form in same page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM