Avatar of Seven price
Seven price
Flag for United States of America asked on

jquery onclick and server side.

Trying use a jquery onclick event and serverside button submission one work without the other. need both to work at the same time.

  $(document).ready(function () {
           $('[id$="txtSubmit"]').each(function (index, button) {
           var oldClickHandler = button.onClick;
           $(button).click(function (clickEvent) {
alert("work");
   oldClickHandler.call(button, clickEvent);
           });
       });
       });

Open in new window


<asp:Button runat="server"    ID="txtSubmit" Text="Next" />
 Protected Sub txtSubmit_Click(sender As Object, e As EventArgs) Handles txtSubmit.Click
function work here
response.write("function started")
End sub
.NET ProgrammingWordPressMicrosoft Development

Avatar of undefined
Last Comment
Seven price

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Michel Plungjan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Seven price

ASKER
Well that is the funny part I use the id and it was unique and it worked then it just stopped working. Only the jquery works first and not the server side. Or if I remove the jquery then the client side work. crazy.
Seven price

ASKER
Thanks for the response I resolved everything to javascript and using document.elemenbyid.  on the server side passing values to hidden input textbox.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes