//We can call it via:
$("div").data("role") === "page";
$("div").data("hidden") === true;
$("div").data("options").name === "John";
Data is good for preventing race conditions.
//Given this HTML Structure
- Apple
- Orange
- Mango
- Blueberry
- Watermelon
//We can retrieve the value with:
$('li').each(function(index) {
alert(index + ': ' + $(this).text());
});
//Alternatively, loop through JSON
var data = "{ name: "John", lang: "JS" }";
$.each( data, function(k, v){
alert( "Key: " + k + ", Value: " + v );
});
No comments:
Post a Comment