// Generation
$('section.businessapproaches section h1').each(function() {
var value = this.innerHTML;
$('<input type="checkbox" checked="checked" id="ba_'+value.toLowerCase()+'" name="ba_'+value.toLowerCase()+'"/><label for="ba_'+value.toLowerCase()+'">'+value+'</label>').appendTo($('fieldset.businessapproaches'));
});
$('section.snapshot section h1').each(function() {
var value = this.innerHTML;
$('<input type="checkbox" checked="checked" id="'+value.toLowerCase()+'" name="'+value.toLowerCase()+'"/><label for="'+value.toLowerCase()+'">'+value+'</label>').appendTo($('fieldset.snapshot'));
});
$('section.company').each(processCompanyTime);
// Initialize the start date and end date function.
(function() {
var start = [];
var end = [];
//for each time.start section
$('section.position time.start').each(function(){
//add the 'datetime' attr to the start[]
start.push($(this).attr('datetime'));
//sort start[] by using compareTime
start.sort(compareTime);
//place the first value of start[] in the startdate box
$('#startdate').val(start[0]);
});
$('section.position time.end').each(function(){
end.push($(this).attr('datetime'));
end.sort(compareTime);
$('#enddate').val(end[end.length-1]);
});
})();
$('section.techtable > h1').html($('section.techtable > h1').html().split(' / ').sort().join(' / '));
// Persistence
var formvals = {};
var keyval = location.search.replace('?','').split('&');
$.each(keyval, function() {
var splitval = this.split('=');
formvals[splitval[0]] = splitval[1];
});
$.each($('form')[0].elements, function() {
var key = $(this).attr('name');
if (key && formvals[key]) {
$('#'+key).val(formvals[key]);
} else {
// if ($(this).attr('type') == 'checkbox') {
// $('#'+key)[0].checked = false;
// }
}
});
// Business Approaches
$('fieldset.businessapproaches input').on('change', function() {
var index = $(this).prevAll('input').length - 1;
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.