Blue Theme Orange Theme Green Theme Red Theme
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Home | Forums | ASP.NET 2.0 Tutorials | Web Services | How Do I...? | Class Browser | WPF Quick Starts | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
Search :       Advanced Search »
Home » Blogs Home » Blog Detail

jQuery .data usage

 by Anil Kumar on Jan 20, 2012

Why and how to use .data in JQuery.
Comments: 0 Views: 457 Printable Version 
jQuery .data()  usage :
====================

I use .data for storing values instead of accessing DOM elements. I realized and found a better and faster way of it. In fact I have been using $('#myElementID').data(myKey,myValue); for a while now. 

Check out these cases.  

The other way for the same is as -

$.data('#myElementID', key, value );


case 1 : 

$('#myElementID').data(key,value);

It creates a jQuery object and then do the data parsing. It creates an overhead.

case 2 :

$.data('#myElementID', key, value );

This one is faster than first. As it does not go for object creation.


Thanks.
Please comment.




Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
 
What do you say about this post? Post a comment here
*Title:
*Comment:
 
Comments not available.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor

 Blogger's Profile
Age: Not Available
Location:
Title: Developer
Joined: Dec 05, 2010
Education: Bachelors Degree
 More Blogs from this Blogger
No record available
 Latest Blogs
[Video] OnClose Handler
[Video] Storing and Loading the Window and Toolbar position
The Euclidean Algorithm
Swapping Exe Process
How Exe file is Generated by VS2005 C++ Project?
What is Exe
Header files: Multiple Inclusion problem - Solution B
Header files: Multiple Inclusion problem - Solution A
Header files: Multiple Inclusion problem - Reason
Header files: Multiple Inclusion problem
View all »
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.