Can we force to make button click event happen without actually clicking?
-
Hello Experts, I have a Textbox and a button below it. In that Textbox, I am passing a session value and I want to make that button click event occur without actually clicking it. Is that possible? If Yes How? Can you please tell me with sample code or tutorial?
Your help is much appreciated. Thanks Happy Coding!
-
Hello Experts, I have a Textbox and a button below it. In that Textbox, I am passing a session value and I want to make that button click event occur without actually clicking it. Is that possible? If Yes How? Can you please tell me with sample code or tutorial?
Your help is much appreciated. Thanks Happy Coding!
The server click event or the client click event? What do you want to trigger the event? Is this web forms? MVC? You can just call the click event in js on some event and it'll work, but you've not given enough information to go on, but look at this to get you started http://api.jquery.com/click/[^]
-
The server click event or the client click event? What do you want to trigger the event? Is this web forms? MVC? You can just call the click event in js on some event and it'll work, but you've not given enough information to go on, but look at this to get you started http://api.jquery.com/click/[^]
-
The server click event or the client click event? What do you want to trigger the event? Is this web forms? MVC? You can just call the click event in js on some event and it'll work, but you've not given enough information to go on, but look at this to get you started http://api.jquery.com/click/[^]
-
button is in ASP web form. I want that event to happen before user clicks on it.
Your help is much appreciated. Thanks Happy Coding!
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script></head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="Text1" runat="server" />
<asp:Button ID="Button1" OnClick="Button1_Click" Text="Click" runat="server" /><script type="text/javascript"> $(document).ready(function () { // click the button on page load // $("#<%=Button1.ClientID%>").click(); // or click the button when the textbox loses focus $("#<%=Text1.ClientID%>").blur(function () { $("#<%=Button1.ClientID%>").click(); }); }); </script> </form>
</body>
</html> -
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script></head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="Text1" runat="server" />
<asp:Button ID="Button1" OnClick="Button1_Click" Text="Click" runat="server" /><script type="text/javascript"> $(document).ready(function () { // click the button on page load // $("#<%=Button1.ClientID%>").click(); // or click the button when the textbox loses focus $("#<%=Text1.ClientID%>").blur(function () { $("#<%=Button1.ClientID%>").click(); }); }); </script> </form>
</body>
</html>My both the buttons are not in same.
<form id="TireQuickSearch" method="post" action="DealerTireSearchResults.aspx" onsubmit="return ValidateTireQuickSearch(this);">
<input type="hidden" name="FormAction" value="TireQuickSearch" />
<input type="hidden" name="SortOrder" value="<asp:Literal id='litSortOrderDescription' runat='server' /> />
<label> <input type="text" name="TireQuickSearch" id="PART#" class="tf1" value="<asp:Literal id='litTireQuickSearch' runat='server' /> />
</label>
<input name="SearchButton" type="image" src="images/btn_tireSearchADV-dim.jpg" disabled="disabled" /><br />
</form>On the below button click I want my above Button click action to happen
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
Your help is much appreciated. Thanks Happy Coding!
-
My both the buttons are not in same.
<form id="TireQuickSearch" method="post" action="DealerTireSearchResults.aspx" onsubmit="return ValidateTireQuickSearch(this);">
<input type="hidden" name="FormAction" value="TireQuickSearch" />
<input type="hidden" name="SortOrder" value="<asp:Literal id='litSortOrderDescription' runat='server' /> />
<label> <input type="text" name="TireQuickSearch" id="PART#" class="tf1" value="<asp:Literal id='litTireQuickSearch' runat='server' /> />
</label>
<input name="SearchButton" type="image" src="images/btn_tireSearchADV-dim.jpg" disabled="disabled" /><br />
</form>On the below button click I want my above Button click action to happen
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
Your help is much appreciated. Thanks Happy Coding!
<asp:Button ID="Button1" Text="Click" runat="server" OnClientClick="return doSearch();" />
<script type="text/javascript">
function doSearch()
{
// this will not work if the button is disabled as in your example
//$("[name='SearchButton'").click();// can submit the form instead $("#TireQuickSearch").submit(); return false; }
-
<asp:Button ID="Button1" Text="Click" runat="server" OnClientClick="return doSearch();" />
<script type="text/javascript">
function doSearch()
{
// this will not work if the button is disabled as in your example
//$("[name='SearchButton'").click();// can submit the form instead $("#TireQuickSearch").submit(); return false; }
-
<asp:Button ID="Button1" Text="Click" runat="server" OnClientClick="return doSearch();" />
<script type="text/javascript">
function doSearch()
{
// this will not work if the button is disabled as in your example
//$("[name='SearchButton'").click();// can submit the form instead $("#TireQuickSearch").submit(); return false; }
-
Hello Experts, I have a Textbox and a button below it. In that Textbox, I am passing a session value and I want to make that button click event occur without actually clicking it. Is that possible? If Yes How? Can you please tell me with sample code or tutorial?
Your help is much appreciated. Thanks Happy Coding!
Yes it is possible. suppose your button name is btnAdd and you want btnAdd_click() event fire automatically on page load (suppose) , so on pageload call btnAdd_Click() like this: btnAdd_Click(this, null); This will fire the event of btnAdd_Click() without actually clicked.
hi