Hi ! I am new in jquery and web programming.
simply my concept is when i click an asp.net
button then its run on server and page refreshed.
so we use jquery to run asp.net control on client side.
for this i write this following code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#Button1").click(function () {
var a = $("#TextBox1").val();
if (a > 5)
$("#mydiv").text(a + ' is greater then 5')
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
<div id="mydiv"></div>
</div>
</form>
</body>
</html>
it's work fine. but the message which generated by this code"$("#mydiv").text(a + ' is greater then 5')"
is not remaining in page.because page is refreshed.
my quesion is inspite of calling button click by
jquery why my page refreshed and message is not remaining in page.
thanks all.