Skip to content

Commit

Permalink
adds support for >1 value being passed to remote select
Browse files Browse the repository at this point in the history
  • Loading branch information
smcpherson committed Oct 21, 2020
1 parent 61e6fdd commit 2e192f2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions jquery.chained.remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"use strict";

$.fn.remoteChained = function(options) {

var settings = $.extend({}, $.fn.remoteChained.defaults, options);

/* Loading text always clears the select. */
Expand All @@ -38,7 +37,13 @@
var data = {};
$(settings.parents).each(function() {
var id = $(this).attr(settings.attribute);
var value = ($(this).is("select") ? $(":selected", this) : $(this)).val();
var value = []


$(":selected", this).each(function() {
value.push($(this).val());
});

data[id] = value;

/* Optionally also depend on values from these inputs. */
Expand Down Expand Up @@ -164,4 +169,4 @@
clear : false
};

})(window.jQuery || window.Zepto, window, document);
})(window.jQuery || window.Zepto, window, document);

0 comments on commit 2e192f2

Please sign in to comment.