diff options
author | lou <louiscuny@gmail.com> | 2013-06-26 16:33:31 +0200 |
---|---|---|
committer | lou <louiscuny@gmail.com> | 2013-06-26 16:34:09 +0200 |
commit | a68070e11a8bbc3fd6ff8cbe289a868343ea421a (patch) | |
tree | 985622424df2e8ee8249c09e64e89df4b8e1fe3f | |
parent | 6e061a0a7fabfb76f47f422c16dfeabc7d366b21 (diff) | |
download | multi-select-a68070e11a8bbc3fd6ff8cbe289a868343ea421a.zip multi-select-a68070e11a8bbc3fd6ff8cbe289a868343ea421a.tar.gz multi-select-a68070e11a8bbc3fd6ff8cbe289a868343ea421a.tar.bz2 |
fix multiselect ID generation
-rw-r--r-- | js/jquery.multi-select.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/js/jquery.multi-select.js b/js/jquery.multi-select.js index d6a0c18..eb1f4cb 100644 --- a/js/jquery.multi-select.js +++ b/js/jquery.multi-select.js @@ -21,9 +21,7 @@ this.options = options; this.$element = $(element); - var id = this.$element.attr('id'); - - this.$container = $('<div/>', { 'id': "ms-"+id, 'class': "ms-container" }); + this.$container = $('<div/>', { 'class': "ms-container" }); this.$selectableContainer = $('<div/>', { 'class': 'ms-selectable' }); this.$selectionContainer = $('<div/>', { 'class': 'ms-selection' }); this.$selectableUl = $('<ul/>', { 'class': "ms-list", 'tabindex' : '-1' }); @@ -42,7 +40,8 @@ if (ms.next('.ms-container').length === 0){ ms.css({ position: 'absolute', left: '-9999px' }); - ms.attr('id', ms.attr('id') ? ms.attr('id') : 'ms-'+Math.ceil(Math.random()*1000)); + ms.attr('id', ms.attr('id') ? ms.attr('id') : Math.ceil(Math.random()*1000)+'multiselect'); + this.$container.attr('id', 'ms-'+ms.attr('id')); var optgroupLabel = null, optgroupId = null, |