jQuery: Single button click, click event firing two or more times
Date : March 29 2020, 07:55 AM
it should still fix some issue Your problem may be happening because you are assigning the same handler to the click event multiple times. I suggest you check that the line where you assign the handler is not being called multiple times inadvertently. Another solution could be a call to unbind (deprecated 3.0) or off (superseeded) first: $("#myButton").unbind("click").click(myHandler); // deprecated
$("#myButton").off("click").click(myHandler); // superseeded
|
Jquery Click Event Not Firing On First Click, but does on second click, why?
Date : March 29 2020, 07:55 AM
help you fix your problem This is a longshot, but are you running some sort of tracking script? Like webtrends or coremetrics (or even some of your own script, that's globally looking for all clicks)? I ran into a similar problem a while ago, where the initial-click was being captured by coremetrics. Just a thought.
|
Date : March 29 2020, 07:55 AM
it helps some times I have to display a popup when user clicks on Place button inside a gridview and please remeber it that as user clicks the Place button, i have to capture the value of commandArgument in a module level variable so that i can update it in Database. Now as and when page displays and user clicks the Place button the page postback to server and then popup appears and at the same time i capture the value of commandargument of button in code behind. But, after the first click that is from 2nd time click of button displays the popup without sending the page on server. That is it's not firing the onClick event of Place button and the value in module level variable remains unchanged. After that if user selects Ok button from popup it updates the value which sets in the module level variable when the Place button called at first. <GridView id= "Grd" runat="server" AutoGenerateColumns="false" CssClass="GridStyle"
HeaderStyle-Font-Size="Small" Width="960" Visible="false">
<Columns>
'Columns goes here
<asp:TemplateField HeaderText="Action" HeaderStyle-Width="310px" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Button ID="btnDelete" runat="server" Text="Delete" OnClick="btnDelete_Click"
CommandArgument='<%#Eval("intHireEnquiryID") %>' />
<asp:Button ID="btnPlace" runat="server" Text="Place" OnClick="btnPlace_Click"
CommandArgument='<%#Eval("intHireEnquiryID") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</GridView>
<asp:UpdatePanel ID="upPopupPnl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel runat="server" ID="pnlPopup" Width="300px" Height="300px" BackColor="Azure"
style="overflow:auto;border-color:Black;border-style:solid;border-width:2px;">
<table><tr><td colspan="2" style="width:300px;">
<asp:RadioButtonList ID="rbl1" runat="server">
</asp:RadioButtonList>
</td></tr>
<tr><td style="text-align:center;">
<asp:Button ID="btnPlacePopup" runat="server" Text="Place" Width="100" Height="35" Font-Bold="true"
OnClick="btnPlacePopup_Click" />
</td>
<td style="text-align:center;">
<asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="100" Height="35" Font-Bold="true" />
</td></tr>
</table>
</asp:Panel>
<asp:Button ID="btnDummy" runat="server" Text="Not Display" style="display:none;"/>
<ajaxtk:ModalPopupExtender ID="actPopup1" runat="server" TargetControlID="btnDummy" BackgroundCssClass="modalBackground"
PopupControlID="pnlPopup" CancelControlID="btnCancel">
</ajaxtk:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
.modalBackground
{
background-color:#B3B3CC;
opacity:0.5;
}
dim intHireEnquiryIDas integer
Protected Sub btnPlace_Click(ByVal sender As Object, ByVal e As System.EventArgs)
intHireEnquiryID = CType(sender, Button).CommandArgument
Dim EXP As New Exception
Dim params(0) As SqlParameter
params(0) = New SqlParameter("@intHireEnquiryID", intHireEnquiryID)
Dim DS As New DataSet
DS = execQuery("spAgent_Get_Assigned_Workers", executionType.SPExecuteForDS, EXP, params)
If DS.Tables(0).Rows.Count > 0 Then
rbl1.DataSource = DS
rbl1.DataTextField = "WorkerDetail"
rbl1.DataValueField = "intWorkerID"
rbl1.DataBind()
End If
upPopupPnl.Update()
actPopup1.Show()
End Sub
|
ExtJs manually firing Click event, button param is different from mouse click
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , So, I have a login controller, you can click login with mouse or press Enter key, like this: , You must use the fireEvent function like that: var myBtn = Ext.getCmp('#idLogin button');
myBtn.fireEvent('click', myBtn);
|
Generic class to detect triple click without firing double- or single-click
Date : March 29 2020, 07:55 AM
Hope that helps Generics are part of the solution. Just do the following: Make your class Click123 Make your constructor public Click123(T targetedComponent) { Call targetedComponent.addMouseListener rather than addMouseListener Create a JFrame or JPanel or whatever and then pass it to your new Click123 as a constructor argument. Then use your JFrame where you were using your Click123.
|