From 3f682508f2ffea6e1fb2887d80e5ac4b7b0e15a9 Mon Sep 17 00:00:00 2001 From: Lukasz Przybysz Date: Sun, 27 Aug 2017 13:58:31 +0200 Subject: [PATCH] Fixed errors with submitted select field values #46 --- jquery.ddslick.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jquery.ddslick.js b/jquery.ddslick.js index 2cdfbb5..10cd51d 100644 --- a/jquery.ddslick.js +++ b/jquery.ddslick.js @@ -79,6 +79,7 @@ if (!data) { var ddSelect = [], ddJson = options.data; + options.data = []; //Get data from HTML select options obj.find('option').each(function () { @@ -98,7 +99,7 @@ else options.data = $.merge(ddSelect, options.data); //Replace HTML select with empty placeholder, keep the original - var original = obj, placeholder = $('').attr('id', obj.attr('id') + '-dd-placeholder'); obj.replaceWith(placeholder); obj = placeholder; @@ -114,6 +115,8 @@ var ddSelect = obj.find('.dd-select'), ddOptions = obj.find('.dd-options'); + ddSelect.find('input').attr('name', original.attr('name')); + //Set widths ddOptions.css({ width: options.width }); ddSelect.css({ width: options.width, background: options.background });