Link to home
Start Free TrialLog in
Avatar of Seven price
Seven priceFlag 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
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 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.
Thanks for the response I resolved everything to javascript and using document.elemenbyid.  on the server side passing values to hidden input textbox.