Skip to content

Instantly share code, notes, and snippets.

@sampottinger
Created January 8, 2013 17:47
Show Gist options
  • Save sampottinger/4485999 to your computer and use it in GitHub Desktop.
Save sampottinger/4485999 to your computer and use it in GitHub Desktop.
function retrieveUserInput()
{
var output = new Object();
output.heifer = { type: "heifer", grazing: {}, nongrazing: {} };
output.bred_heifer = { type: "bred_heifer", grazing: {}, nongrazing: {} };
output.springer = { type: "springer", grazing: {}, nongrazing: {} };
output.first_calf_heifer = { type: "first_calf_heifer", grazing: {}, nongrazing: {} };
output.dry = { type: "dry", grazing: {}, nongrazing: {} };
output.lactating = { type: "lactating", grazing: {}, nongrazing: {} };
$('.tab-pane').find('.feed-in-num').children().each(function(i) {
var active_tab = $(this).parents('.tab-pane').attr('id').split('_')[0];
var feed_id = $(this).attr('id').split('-');
var feed_val = $(this).attr('value');
var new_feed = 'feed_' + i
output.getAttribute(activeTab)[feed_id[1]][new_feed] = { name: feed_id[2], val: feed_val };
});
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment