C # event using jQuery

I need the jQuery event to be fired by pressing an ASP.NET C # button. The following code example, taken from my project, in which instead of document.write('Passed') I need the C # button to press, even if it needs to be done. How can I do that?

Sample code that clicks Button1_Click instead of document.write

 $("#slider").draggable({ axis: 'x', containment: 'parent', drag: function(event, ui) { if (ui.position.left > 550) { document.write('Passed'); $("#well").fadeOut(); } else { } } 
+4
source share
2 answers

I'm not sure if this is what you want, but you can trigger a 'click' event for a button on a page using jQuery. This will cause your event to block the server side, as if the button was pressed manually -

 $('#yourbuttonid').trigger('click'); 
+3
source

Now I'm a little confused. But this is what you want to replace document.write

 $("#Button1").click(function() { alert("Hello world!"); }); 
+1
source

All Articles