You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Get data from HTML select options
obj.find('option').each(function () {
var $this = $(this), thisData = $this.data();
ddSelect.push({
text: $.trim($this.text()),
value: $this.val(),
selected: $this.is(':selected'),
description: thisData.description,
imageSrc: thisData.imagesrc //keep it lowercase for HTML5 data-attributes
});
});
I believe this could be causing a problem. selected: $this.is(':selected') will return true for the first item in the list when there is no selected="selected" attribute (i.e. even when there is nothing truly selected yet). This is jQuery being smart.
However, in the context of your jQuery plugin, this causes a problem, because there is no way to use the selectText config option if selected: $this.is(':selected') always returns at least one true value.
Suggested Fix
//Get data from HTML select options
obj.find('option').each(function (index) {
var $this = $(this), thisData = $this.data();
ddSelect.push({
text: $.trim($this.text()),
value: $this.val(),
selected: obj[0].selectedIndex === index,
description: thisData.description,
imageSrc: thisData.imagesrc //keep it lowercase for HTML5 data-attributes
});
});
Parts changed: function (index) and selected: obj[0].selectedIndex === index,
The text was updated successfully, but these errors were encountered:
From ddSlick source code...
I believe this could be causing a problem.
selected: $this.is(':selected')
will return true for the first item in the list when there is noselected="selected"
attribute (i.e. even when there is nothing truly selected yet). This is jQuery being smart.However, in the context of your jQuery plugin, this causes a problem, because there is no way to use the
selectText
config option ifselected: $this.is(':selected')
always returns at least one true value.Suggested Fix
Parts changed:
function (index)
andselected: obj[0].selectedIndex === index,
The text was updated successfully, but these errors were encountered: