Showing posts with label Jquery. Show all posts
Showing posts with label Jquery. Show all posts

Saturday, September 17, 2016

What is Jquery

JQuery is a Javascript library which is used extensively for client side validation and manipulation of DOM elements. It is a light weight, cross browser compatible and is a repository of many reusable Javascript functions.
the features of jQuery
  • DOM element selections functions
  • DOM traversal and modification
  • Events
  • CSS manipulation
  • Effects and animations
  • Ajax
  • Extensibility
  • Utilities - such as browser version and the each function.
  • JavaScript Plugins 

Tuesday, October 2, 2012

Jquery: How to use index()

.index()- returns an integer indicating the position of the passed element relative to the original collection.
-1 means selector or element not found.

 Three way to use index()
1.index()

2..index( selector )
 selector A selector representing a jQuery collection in which to look for an element.
3..index( element )
element The DOM element or first element within the jQuery object to look for.

 Note : Start index is 0(Zero).

more detail- http://api.jquery.com/index

Example
<html>
<head>
  <style>div { font-weight: bold; color: #090; }</style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  <ul>
  <li id="foo">foo</li>
  <li id="bar">bar</li>
  <li id="baz">baz</li>
</ul>
<div></div>
 <script> 
    var listItem = $('#bar');
    $('div').html( 'Index: ' + $('li').index(listItem) );
 </script>
</body>
</html>
 
Output Demo
  • foo
  • bar
  • baz
Index: 1

Wednesday, August 29, 2012

JQuery:preventDefault() method will do.


e.preventDefault() is the key method, to disable the default operations to proceed further. We first stop the event from further bubbling up to other parent controls and put any custom logic.

@"e" is a event.


Example:
$('#<%=textbox.ClientID%>').bind('cut copy paste',
function (e) {
e.preventDefault();
alert("Cut / Copy / Paste are not allowed.");

});

Hash Table in C#

 The Hashtable is a non-generic collection and used to store the key/value pairs based on the hash code of the key. Key will be used to acce...