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...

SQL Difference between Union & Union All

SQL Difference between Union & Union All The union and union all operators allow you to combine multiple data sets. The difference between the two is that union sorts the combined set and removes duplicates while union all does not. With union all, the number of rows in the final data set will always equal the sum of the number of rows in the sets being combined.[Learning SQL By Alan Beaulieu] When using the UNION command all selected columns need to be of the same data type. For example : X Y UNION UNION ALL A B A A A B B A B A - B - - - B - - - B - - - A Union all is faster than union, union's duplicate elimination requires a sorting operation, which takes time.

Accept only numbers in an textbox.

This javascript function is used to make an text-box to accept number alone. JavaScript: function isNumberKey(evt)                                          {                                             var charCode = (evt.which) ? evt.which : event.keyCode                                             if (charCode > 31 && (charCode < 48 || charCode > 57))                        ...