how do i copy @value of the <option> node to <li>?
I have select node and it comes with options. Here, each option has '@value(1111, 2222)' as attribute.
<select name="a" multiple="multiple" id="b" style="position: absolute; left:-9999px;">
<option value="1111">FLASH</option>
<option value="2222">SSD</option>
</select>
What I noticed was multi-select.js is converting select node and create <li> and when it does it drops '@value' although actual values(FLASH , SSD) are copied over.
How do I keep the @value attribute in <li> as attribute something like @value ?
I thought removing (attr.name !== 'value') would do it but it doesn't look like it works.
'generateLisFromOption' : function(option, index, $container){ ~~~~
if(attr.name !== 'value' && attr.name !== 'disabled'){
Hi There, you can try with this, go to line 117, and you will see something similar to below:
selectableLi
.data('ms-value', value)
.addClass('ms-elem-selectable')
.attr('id', elementId+'-selectable')
**.attr('data-val', value);**
selectedLi
.data('ms-value', value)
.addClass('ms-elem-selection addedOption')
.prepend('<i class="fa fa-minus-circle"></i> ')
.attr('id', elementId+'-selection')
**.attr('data-val', value)**
.hide();
I needed i minus icon because i'm appending selections to another container, and on the end there is a attr, that will pass the value as data-val