diff --git a/followup.joelpurra.js b/followup.joelpurra.js new file mode 100644 index 0000000..c6a60f8 --- /dev/null +++ b/followup.joelpurra.js @@ -0,0 +1,148 @@ +/*! + * @license FollowUpQuestions + * Copyright © 2012 Joel Purra + * Released under MIT, BSD and GPL license. Comply with at least one. + * + * A jQuery plugin to show and hide follow up questions in a form. The + * follow ups are specified through HTML5 [data-*] attributes. + */ +// https://gist.github.com/ +// +// USAGE +// Include the script after jQuery has been loaded. It will check all existing form elements +// and automatically initilaize follow-up questions when the page has loaded. +// +// Note: currently only or can have follow up +// questions, visible when the input has been checked. +// +// Markup for a single question (form input) that has a follow up question +// data-has-follow-up="sibling" +// "sibling" assumes the follow up question(s) containers shares the same parent element. +// data-has-follow-up="selector" +// data-target="#follow-up-question-container-elsewhere" +// "selector" allows addressing any other data-target="..." container element(s) with +// a jQuery style selector. +// +// Markup for containers with multiple radio buttons inside +// data-has-follow-ups="" +// +// Markup for a question that is required when it is a follow up question +// data-is-follow-up-required="required" +// +// Markup for the container of a follow up container +// data-is-follow-up="" +// +// EXAMPLE WITH A GROUP OF RADIO BUTTONS +// Only one of the buttons has a follow up question. Since they are in +// the same group, they will be evaulated together. Changing from yes to no will change the +// visibility of the follow up question +// +// +// +//

+// +// TODO LIST +// - Use with typs and