JavaScript javascript bootstrap-multiselect get all selected values on button click javascript bootstrap multiselect,javascript multiselect bootstrap,js bootstrap multiselect,vue

I want to get all selected values of bootstrap-multiselect on button click.

My JSP page code is given below

<script type="text/javascript">
    $(document).ready(function() {
        $('#ddlPermission').multiselect({
            buttonWidth : '100%',
            maxHeight : 100,
            includeSelectAllOption : true,
            dropRight : true
        });
    });

    function myFunction() {
        var allVal=$("ddlPermission").val();
        alert(allVal);
        return false;
    }
</script>
<body>
    <select id="ddlPermission" multiple="multiple" name="permission_ddl">
        <option value="A">A</option>
        <option value="B">B</option>
        <option value="C">C</option>
        <option value="D">D</option>
    </select>
    <input type="submit" name="btnSubmit" id="btnSubmit" onclick="myFunction()" class="button active" value="Submit">
</body>

I am using Java JSP.

Answer:1

Working fiddle.

You're missing the id sign # in the following line :

var allVal=$("ddlPermission").val();

Should be :

var allVal=$("#ddlPermission").val();

Hope this helps.

Answer:2

I have an attribute that is of string data type.I am using the algoliasearchHelper object to search through my Algolia database. What I want to do is create a facet filter that takes a specified ...

I have an attribute that is of string data type.I am using the algoliasearchHelper object to search through my Algolia database. What I want to do is create a facet filter that takes a specified ...

Sample: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Dynamic Link</title> </head> <body> <input type="text" value="http:...

Sample: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Dynamic Link</title> </head> <body> <input type="text" value="http:...

Hello I have a simple javascript function that chooses a random list item in an unordered list with the press of a button. It works fine, the console spits out a random list item when the button is ...

Hello I have a simple javascript function that chooses a random list item in an unordered list with the press of a button. It works fine, the console spits out a random list item when the button is ...

I am making a Space Invaders clone and I am almost done, but I am having issues with my Space Invaders moving. I have tried using += to move the Space Invaders but this still isn't working. Here is my ...

I am making a Space Invaders clone and I am almost done, but I am having issues with my Space Invaders moving. I have tried using += to move the Space Invaders but this still isn't working. Here is my ...

  1. arena
  2. arena football
  3. arendelle
  4. arena stage
  5. arenado
  6. arenal volcano
  7. arena sports
  8. arent
  9. arenal costa rica
  10. arena theatre
  11. arena of valor
  12. arena stage dc
  13. arena sf
  14. arent fox
  15. arena ktown
  16. arenanet
  17. arenado trade
  18. arenacross
  19. arenal volcano national park
  20. arena theater