<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: get combobox selected display in Calcite Design System Questions</title>
    <link>https://community.esri.com/t5/calcite-design-system-questions/get-combobox-selected-display/m-p/1292369#M407</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/14521"&gt;@LefterisKoumis&lt;/a&gt;&amp;nbsp;Depending on the intent, you can use JavaScript, for instance:&lt;/P&gt;&lt;P&gt;Loop through selected items:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;document.getElementById("test").addEventListener("calciteComboboxChange", (evt) =&amp;gt; {
    for (item of evt.target.selectedItems) {
      console.log(item.textLabel);
    }
});&lt;/LI-CODE&gt;&lt;P&gt;Gather the latest selected item:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;document.getElementById("test").addEventListener("calciteComboboxChange", (evt) =&amp;gt; {
  const selectedItemNumber = evt.target.selectedItems.length - 1;
  console.log(evt.target.selectedItems[selectedItemNumber]?.textLabel);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 23 May 2023 23:15:38 GMT</pubDate>
    <dc:creator>KittyHurley</dc:creator>
    <dc:date>2023-05-23T23:15:38Z</dc:date>
    <item>
      <title>get combobox selected display</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/get-combobox-selected-display/m-p/1292338#M406</link>
      <description>&lt;P&gt;I have this simple calcite combobox. I want to capture the selected display,not its value.&lt;/P&gt;&lt;P&gt;It is simple to get the value.&lt;/P&gt;&lt;P&gt;So, if I select the first option how do I capture "One", the text-label value?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/lkoumis1/pen/mdzvBKv?editors=1111" target="_blank" rel="noopener"&gt;https://codepen.io/lkoumis1/pen/mdzvBKv?editors=1111&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;link rel="stylesheet" href="https://unpkg.com/@esri/calcite-components/dist/calcite/calcite.css" /&amp;gt;
&amp;lt;script src="https://unpkg.com/@esri/calcite-components/dist/calcite/calcite.esm.js" type="module"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;calcite-combobox id="test"&amp;gt;
  &amp;lt;calcite-combobox-item value="1" text-label="One"&amp;gt;&amp;lt;/calcite-combobox-item&amp;gt;
  &amp;lt;calcite-combobox-item selected value="2" text-label="Two"&amp;gt;&amp;lt;/calcite-combobox-item&amp;gt;
&amp;lt;/calcite-combobox&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;document
  .getElementById("test").addEventListener("calciteComboboxChange", function (event) {
  console.log(document.getElementById("test").value)
  
})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 22:06:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/get-combobox-selected-display/m-p/1292338#M406</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2023-05-23T22:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: get combobox selected display</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/get-combobox-selected-display/m-p/1292369#M407</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/14521"&gt;@LefterisKoumis&lt;/a&gt;&amp;nbsp;Depending on the intent, you can use JavaScript, for instance:&lt;/P&gt;&lt;P&gt;Loop through selected items:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;document.getElementById("test").addEventListener("calciteComboboxChange", (evt) =&amp;gt; {
    for (item of evt.target.selectedItems) {
      console.log(item.textLabel);
    }
});&lt;/LI-CODE&gt;&lt;P&gt;Gather the latest selected item:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;document.getElementById("test").addEventListener("calciteComboboxChange", (evt) =&amp;gt; {
  const selectedItemNumber = evt.target.selectedItems.length - 1;
  console.log(evt.target.selectedItems[selectedItemNumber]?.textLabel);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 23:15:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/get-combobox-selected-display/m-p/1292369#M407</guid>
      <dc:creator>KittyHurley</dc:creator>
      <dc:date>2023-05-23T23:15:38Z</dc:date>
    </item>
  </channel>
</rss>

