I've been reading the jQuery documentation and trying to improve this function(well functions) and its siblings, however I'm running into all sorts of syntactical errors when I make changes past this point. For example, I know there is a better way to write this.elements ['activities[ActivitiesTab]'].value = ckd; or var radios = document.forms['ActivitiesTab'].elements['activities[ActivitiesTab]'];
But the biggest issue is I know there are alternatives to statements I make that can be much shorter and faster with jQuery, but any attempts I make just seem to break it. Any insight into this issue would be appreciated, thanks! initActivityForms: function() { var radios = document.forms['ActivitiesTab'].elements ['activities[ActivitiesTab]']; $(actids).each(function(i) { var fmName = 'ticketSearchForm' + actids[i].ucFirst(); var fm = document.forms[fmName]; $(radios[i]).click(function() { $.bots.toggleASF(actids[i]); }); $(fm).submit(function() { $(radios).each(function(i) { if (radios[i].checked) { ckd = radios[i].value; } }); this.elements['activities[ActivitiesTab]'].value = ckd; }); }); radios[0].checked = true; }, toggleASF: function(actid) { $(actids).each(function(i) { var obb = $('#' + actids[i]); if (actid == actids[i]) { $(obb).show(); } else { $(obb).hide(); } }); },