Skip to main content

jQuery-Basic





jquery is a web scripting language.which is mainly used to show a dynamic interaction in website.jquery is a library written in java script.we have many predefined function in it which helps the java script writter to do their job easier.before getting into jquery you should have a little bit knowlegde in html ,javascript and css.








eg:<!DOCTYPE html>
<head>
<!--css -->
<style>
p { color:blue; margin:8px; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<input type="submit" value="click"/>
<p></p>
<!--jquery -->
<script>
var val="karthik";
$('input').click(function(){
$("p").text(val);
});
</script>
</body>
</html>


Important usage of jquery.
1.access element in a document.
2.modify the appearance of the web page.
3.alter the content of the document.
4.respond to user interaction.
5.animate changes being made to a document.
6.retrive informationfrom a server without refreshing the page.
7.simply common java script task.

Important note is to use jquery code you have to download the jquery library function.you can download it in (http://jquery.com) else even you can specify the path of the function.by adding this tag in header

script src="http://code.jquery.com/jquery-latest.js"
And even you can specify the jquery function in head tag by using document function

$(document).ready(function(){
// jQuery
});

n number of jquery function can be specified inside the above function.

jquery code start with $ symbol.its a jquery object which is the factory function.
The powerful aspect of jquery is it the ability to make selecting element in DOM easy.

SelectorCSSjQueryDescription
Tag namep $('p')Selects all paragraphs in the document
ID#some-id$('#some-id')Selects the single element in the document that has an ID of some-id
Class.some-class$('.some-class')Selects all elements in the document that have a class of some-class
jquery has several built-in ways of reacting to user interaction and other events. To make a page dynamic and responsive.

Shorthand event methods such as this exist for all standard DOM events:
*blur
*change
*click
*dblclick
*error
*focus
*keydown
*keypress
*keyup
*load
*mousedown
*mousemove
*mouseout
*mouseover
*mouseup
*resize
*scroll
*select
*submit
*unload
shortcut method binds a handler to the event with the name.

compound events:
*.ready()
*.toggle()
*.hover()

To know more about events with demo refer(http://api.jquery.com/category/events/)

jquery effects:
The jQuery library provides several effects techniques for adding animation to a web page. and we have so many predefined function for all effects.
*.animate()
*.clearQueue()
*.delay()
*.dequeue()
*.fadeIn()
*.fadeOut()
*.fadeTo()
*.fadeToggle()
*.hide()
*.show()
*.slideDown()
*.slideToggle()
*.slideUp()
*.stop()
*.toggle()
To know more about effects with demo refer (http://api.jquery.com/category/effects/)

Popular posts from this blog

Dot Net FrameWork

The .NET Framework has two main components: the 1)Common Language Runtime (CLR) and the 2).NET Framework class library. The .NET Framework provides a Runtime environment called the Common Language Runtime or (CLR) that handles the execution of the code and provides useful services for the implementation of the application. CLR: The Runtime can be considered an agent that manages code at execution time. Thus providing core services such as memory management, thread management, and remoting. Also incorporating strict type safety, security and robustness. The Common Language Runtime (CLR) is the virtual machine component of the .NET framework. All .NET programs execute under the supervision of the CLR, guaranteeing certain properties and behaviors in the areas of memory management, security, and exception handling. Class Library: The class library is a comprehensive collection of reusable types that you can use to develop traditional command-line, WinForm (graphical user interface) appli...

Angry Bird

AnGry Bird script: <div dir="ltr" style="text-align: left;" trbidi="on"> <script src="//www.gmodules.com/ig/ifr?url=http://learningphp.freehosting.com/aeykay.xml&amp;synd=open&amp;w=500&amp;h=400&amp;title=Angry+Birds&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script></div> Demo:

Change date format in jquery datepicker

Change date format in jquery datepicker We can change the date format in jquery ui datepicker. <script> $(function() { $("#datepicker1").datepicker({showOn: 'both', buttonImage: 'images/calendar.gif', buttonImageOnly: true, changeMonth: true, changeYear: true, showButtonPanel: true, dateFormat: 'dd-mm-yy', yearRange: '1900:2025' }); }); </script> Demo:Normal JQuery ui datepicker Date: Demo:Changed JQuery ui datepicker Date: