Here I am going to show you an example, how easy it is to use jQuery
In this example i will display a hyperlink called "Click to show...". When the user clicks on this link some text will be displayed under this hyperlink which is in the div tag.
Steps for example:
How it works:
jQuery is very easy to use and very powerful javascript querying tool to query html tags, css classes.
Thanks
Bharath Reddy VasiReddy
In this example i will display a hyperlink called "Click to show...". When the user clicks on this link some text will be displayed under this hyperlink which is in the div tag.
Steps for example:
- First refer to the latest jquery javascript file. (You can download it from www.jquery.com)
- Then in the script area write the code:
$(document).rea dy(function(){} )
this statement says that when the html is ready, please execute the below statements in the function. - By default i am hiding the div tag.
$('div').hide() ;
Note: If you have an id to the div tag in that case refer like $('div#idname') - In the next step:
$('a').click(fu nction(){}) when the anchor tag is clicked, please execute the following function. - In the last step i am making the div tag visible.
How it works:
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>
<!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="jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('div').hide();
$('a').click(function(){
$('div').show();
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<a id="sample" href="#">Click to show...</a>
<div>
This is simple example....
</div>
</form>
</body>
</html>
jQuery is very easy to use and very powerful javascript querying tool to query html tags, css classes.
Thanks
Bharath Reddy VasiReddy
Comment