Created
February 29, 2012 16:31
-
-
Save ramhoj/1942266 to your computer and use it in GitHub Desktop.
Date picker defaults
This file contains hidden or 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
| var occurrences = $(".occurrences"); | |
| if(occurrences.find(".error").length > 0) { | |
| occurrences.find("a.add").hide(); | |
| } else { | |
| occurrences.find(".fields:not(:has(input[type='checkbox'])):not(:first)").hide(); | |
| occurrences.find("a.add").click(function(e) { | |
| var prevOccurrence = occurrences.find(".fields:not(:hidden):last"); | |
| var nextOccurrence = occurrences.find(".fields:hidden:first"); | |
| var inputs = "input[type='text'], select"; | |
| // Start of copy-over values spike | |
| prevOccurrence.find(inputs).each(function(i, e) { | |
| var source = $(e).val(); | |
| var destination = $(nextOccurrence.find(inputs).get(i)); | |
| destination.val(source); | |
| }); | |
| // End of copy-over values spike | |
| nextOccurrence.show(); | |
| e.preventDefault(); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment