How to give alert message in jQuery on a Button Click ?

 Posted by Akiii on 9/30/2011 | Category: jQuery Interview questions | Views: 9847 | Points: 40

Hi all,
First, include jQuery in your application.

Drop a textbox in your .aspx page:-
<input id="inputField" type="text" size="12"/> 

include a button also:-
<asp:Button ID="Button1" runat="server" Text="get"/> 

Now, here's the script:-

<script type="text/javascript">
$(document).ready(function () {
$('#Button1').click(function () {

On the click of the button, an alert will be given containing the text in the text box.

I hope this helps......
Thanks and Regards

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response