Coder Social home page Coder Social logo

jquery-dependent-questions's People

Contributors

jakiestfu avatar jrsinclair avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jquery-dependent-questions's Issues

Drop Down Menus

How do I configure this auto-load for a drop-down menu?
<form action="?" id="myform">
<fieldset class="form-question">
<legend>What type of event are you planning?
<div class="general-event-question">
<select name="eventType" id="eventTypeDropDown">
<option value="wedding" name="eventType" id="isAWeddingEvent">A Wedding
<option value="general" name="eventType" id="isAGeneralEvent" for="eventTypeDropDown">
<<abel for="isAGeneralEvent">A General Event
</option>

  &lt;/select>
&lt;/div>

</fieldset>
<fieldset data-depends-on="eventType=isAGeneralEvent">
<p>hi


<div class="form-question">
<label for="extra">What else would you like to add?
<input type="text" name="extra" id="extra"/>
</div>
</fieldset>
</form>
It seems like this only works for tags akin to <input>

Thank you!

checkboxes with input type=hidden default values idiom

Hey,

lots of frameworks generate an <input type="hidden" name="check" value="default"> directly before the checkbox when using a checkbox. This leads to a problem with this plugin: it assumes that the checkbox isn't a multi plugin and its value is always the default value.

I did the following patch to get it working:

@@ -88,16 +88,19 @@

             elType = el.attr("type");
             multi  = contains(multiInputs, elType);
-            if (!multi) { return el.val(); }
+            if (!multi && (el.length < 1 || $(el[0]).attr('type') != 'hidden')) { return el.val(); }

             if (elType === "radio") { return el.filter(":checked").val(); }

-            if (elType === "checkbox") {
-                checkVals = $.map(el.filter(":checked"), function (checkbox) {
-                    return $(checkbox).val();
-                });
-                return checkVals;
+            checkVals = $.map(el.filter(":checked"), function (checkbox) {
+                return $(checkbox).val();
+            });
+
+            if($(el[0]).attr("type") == 'hidden' && checkVals.length === 0) {
+                checkVals = [$(el[0]).val()];
             }
+
+            return checkVals;
         }

         // Event handler for when a toggling element changes value.

This is not the most beautiful solution, but at least it works.

Irrelevant: What's the theme you use for your website ?

Hi @jrsinclair ,
I was impressed by your website when I was landed on it by Google search, so I'm curious what's the theme/tool/lib you use for rendering it .. Or is it written by yourself ?
Also, would you like to share it or make it open sourced ? I guess people will like it

Cheers.

Screen Shot 2020-05-05 at 6 05 09 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.