Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
    <title>Dojo MultiSelect Dijit with ArcGIS JS API 3x v1</title>
    <link rel="stylesheet" href="" />
    <script src=""></script>

      body {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
      #bannerDiv {
        width: 100%;
        height: 190px;
        background-color: #FFCCCC;
        text-align: center;
        padding: 5px;
      #viewDiv {
        position: absolute;
        width: 100%;
        height: calc(100% - 180px);

      ], function(Map, FeatureLayer, MultiSelect, dom, on) {
        var map = new Map("viewDiv", {
          center: [-73.95, 40.73], 
          zoom: 10,               
          basemap: "gray"
        var flDistricts = new FeatureLayer(
        function applyDefinition() {
          const selected = document.querySelectorAll('#boros option:checked');
          const values = Array.from(selected).map(el => el.value);

          var strDefinitionExpression = "";

          // build the where clause definition expression string based on user input
          if (values.length === 1) {
            strDefinitionExpression = "boroname = '" + values[0] + "'";
          if (values.length > 1) {
            strDefinitionExpression = "boroname = '" + values[0] + "'";
            for (i=1; i<values.length; i++) {
              strDefinitionExpression = strDefinitionExpression + " OR boroname = '" + values[i] + "'";
              /// better maybe to use IN, rather than chaining ORs.
            // filter the layer based on the where clause built from the multiselect box
        } // end of function applyQueryDef()

        function clearDefinition() {

          var elemMultiSelect = dom.byId("boros");

          // deselect all elements in the multiselect box UI
          for (i=0; i<elemMultiSelect.length; i++) {
            elemMultiSelect[i].selected = false;
          // clear out the definition expression so that all features draw

        } // end of function clearQueryDef()

        on(dom.byId("btnApplyDefinition"), "click", applyDefinition);
        on(dom.byId("btnClearDefinition"), "click", clearDefinition);
      }); //end of require

    <div id="bannerDiv">
      <h4>How to use a dojo/MultiSelect box to apply a layer definition expression</h4>
      <h5>Use click, shift-click, ctrl-click to multi-select values, then click APPLY.</h5>

      <select data-dojo-type="dijit/form/MultiSelect" 
              multiple="true" style="height:80px;width:100px" 
              id="boros" name="boros" size="4">
        <option value="Manhattan">Manhattan</option>
        <option value="Bronx">Bronx</option>
        <option value="Brooklyn">Brooklyn</option>
        <option value="Queens">Queens</option>        
        <option value="Staten Island">Staten Island</option>
      <button class="btn" id="btnApplyDefinition">Apply</button>
      <button class="btn" id="btnClearDefinition">Clear</button>

    <div id="viewDiv"></div>