[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

jquery onclick and server side.

Posted on 2013-05-22
3
Medium Priority
?
680 Views
Last Modified: 2013-05-23
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
0
Comment
Question by:Seven price
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 39190288
IDs MUST be unique so either use a class or if you only have one button, remove the each and have

$(document).ready(function () {
  var but = $("#txtSubmit"); // or $("<%= txtSubmit.ClientID %>");
  but.get(0)._onclick=but.get(0).onclick; // save the DOM onclick
  but.on("click",function (e) {
    alert("work");
     this._onclick.call(this, e);
   });
});

Open in new window

0
 
LVL 9

Author Comment

by:Seven price
ID: 39190946
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.
0
 
LVL 9

Author Closing Comment

by:Seven price
ID: 39191856
Thanks for the response I resolved everything to javascript and using document.elemenbyid.  on the server side passing values to hidden input textbox.
0

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question