Skip to content

Instantly share code, notes, and snippets.

@leandroh
Created May 4, 2010 17:42
Show Gist options
  • Save leandroh/389713 to your computer and use it in GitHub Desktop.
Save leandroh/389713 to your computer and use it in GitHub Desktop.
simple query string parser based on element id and value
var queryString = {
createById: function() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
var el = document.getElementById(arguments[i]);
args[i] = el.id + "=" + el.value;
}
return args.join("&");
}
};
queryString.createById('firstId', 'secondId', 'thirdId');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment