Created
September 7, 2012 06:21
-
-
Save RodrigoEspinosa/3663781 to your computer and use it in GitHub Desktop.
DOM to JSON parser for jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DOM2JSON(){ | |
var Items = new Array; | |
$(".contenedor").each(function(index){ | |
var label = $(this).children("label").text(); | |
var type = $(this).children("input, textarea")[0]; | |
var name = $(this).children("input, textarea").attr("name") || null; | |
var placeholder = $(this).children("input, textarea").attr("placeholder") || null; | |
Items.push(new Item(label, type, name, placeholder)); | |
}); | |
return Items; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment