git @ Cat's Eye Technologies DAM / master demo / select.html
master

Tree @master (Download .tar.gz)

select.html @masterraw · history · blame

<!DOCTYPE html>
<!--
SPDX-FileCopyrightText: In 2019, Chris Pressey, the original author of this work, placed it into the public domain.
For more information, please refer to <https://unlicense.org/>
SPDX-License-Identifier: Unlicense
-->
<head>
  <meta charset="utf-8">
  <title>DAM select demo</title>
</head>
<body>

<h1>DAM select demo</h1>

<p>DAM comes with a select widget.  This widget provides a dropdown control where each
selection is associated with some data.</p>

<div id="installation"></div>

<script src="../dist/dam-plus-widgets-0.2.js"></script>
<script>
  var div=DAM.maker("div"), p=DAM.maker("p"), span=DAM.maker("span"), button=DAM.maker("button");
  var statusBar = span();
  function updateStatus(msg) {
    statusBar.innerHTML += "<p>selected " + msg + "</p>";
  }
  document.getElementById('installation').appendChild(
    div(
      DAM.makeSelect({
        options: [
          {
            text: "First",
            value: 1,
          },
          {
            text: "Second",
            value: 2,
            selected: true
          },
          {
            text: "Third",
            value: 3,
          }
        ],
        onchange: function(option) {
          updateStatus(option.value);
        }
      }),
      statusBar
    )
  );
</script>

</body>