JQuery Developer Question:

Download Job Interview Questions and Answers PDF

If you have a server control(asp.net server control, Button) and on the click of button you want to call a jquery function, So tell me how you will call a jquery function without postback?

JQuery Developer Interview Question
JQuery Developer Interview Question

Answer:

ASP.NET provides the OnClientClick property to handle button clicks. You can use this property on Button, LinkButton and ImageButton. The same OnClientClick property also allows you to cancel a postback.
So I can use OnClientClick property and Jquery function will return false.

Example:
Code:
<script type="text/javascript">
function callMe()
{
alert('Hello');
return false;
}
</script>
<asp:Button ID="Button1" runat="server" OnClientClick="return callMe();" Text="Button" />

Download JQuery Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Why we need jQuery?When can JQuery be used?