How do I get the selected values ​​using jQuery-asmselect?


This should be real easy. I am using asmselect plugin for my listbox (Html.Listbox). I want to get the selected items of the listbox (asmselect) through Jquery.

Any help in this regard is much appreciated.

There's another thing tricky I was trying to figure out how to do. That is, load the options dynamically with the amsSelect.

Here's how to do it.

$(document).ready(function () {
        var hdn = document.getElementById('<%= hdnOptions.ClientID %>').value;
        var theOptions = hdn.split('|');
        var elSel = document.getElementById('theSelectID');
        for (var i = 0; i < theOptions.length; i++) {
            var elOptNew = document.createElement('option');
            elOptNew.text = slmn[i];
            try {
                elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
            catch (ex) {
                elSel.add(elOptNew); // IE only
            addItemTarget: 'bottom',
            animate: true,
            highlight: true,
            sortable: true

The first part of the function gets some options separated by pipe from a hidden value.
Then I add the elements to the select using the id of the select.
The important thing to remember is to add the options before calling the asmSelect initializer.