<?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: $element not working to find ID of html-elements in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2422710#M19987</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/145804"&gt;@alex_colombo&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;I have tried that, but no luck... Even with the included objectID, which is put together like:&lt;/P&gt;
&lt;P&gt;$(""+layout.qInfo.qId+"myCheckBox").find('#myCheckbox').on("change",function(e) {});&lt;/P&gt;</description>
    <pubDate>Fri, 23 Feb 2024 07:01:24 GMT</pubDate>
    <dc:creator>johannaalmm</dc:creator>
    <dc:date>2024-02-23T07:01:24Z</dc:date>
    <item>
      <title>$element not working to find ID of html-elements</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2418729#M19907</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm developing one of my first extensions and it works as long as it is the only instance of said extension on the page. However, when I have multiple extensions on the same sheet, my eventlisteners start acting up. I've included the specific rows of code which confuses me:&lt;/P&gt;
&lt;P&gt;$element.html(&lt;BR /&gt;'&amp;lt;li class="lui-list__item" id="myCheckbox"&amp;gt;'+&lt;BR /&gt;'&amp;lt;input type="checkbox" id="myCheckbox"&amp;nbsp; class="myClass"/&amp;gt;'+&lt;BR /&gt;'&amp;lt;label for="myCheckbox" class="lui-list__text" id="myCheckboxLabel"&amp;gt;abc'+&lt;BR /&gt;'&amp;lt;span class="lui-icon lui-icon--tick" aria-hidden="true"&amp;gt;'+&lt;BR /&gt;'&amp;lt;/label&amp;gt;'+&lt;BR /&gt;'&amp;lt;/li&amp;gt;'+&lt;BR /&gt;'&amp;lt;li class="lui-list__item" id="&lt;SPAN&gt;otherCheckboxLi&lt;/SPAN&gt;"&amp;gt;'+&lt;BR /&gt;'&amp;lt;input type="checkbox" id="&lt;SPAN&gt;otherCheckbox&lt;/SPAN&gt;" class="advancedCheckBoxes"/&amp;gt;'+&lt;BR /&gt;'&amp;lt;label for="&lt;SPAN&gt;otherCheckbox&lt;/SPAN&gt;" class="lui-list__text" id="&lt;SPAN&gt;otherCheckboxLabel&lt;/SPAN&gt;"&amp;gt;cde'+&lt;BR /&gt;'&amp;lt;span class="lui-icon lui-icon--tick" aria-hidden="true"&amp;gt;'+&lt;BR /&gt;'&amp;lt;/label&amp;gt;'+&lt;BR /&gt;'&amp;lt;/li&amp;gt;');&lt;/P&gt;
&lt;DIV&gt;console.log($element.find("#myCheckbox"));&lt;/DIV&gt;
&lt;DIV&gt;&lt;STRONG&gt; $element.find('#myCheckbox').on("change",function(e) {&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;console.log(layout.qInfo.qId)&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;if($element.find('#myCheckbox').checked == true) {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; $element.find("#otherCheckboxLi").addClass("lui-disabled");&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; else {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; $element.find("otherCheckboxLi").removeClass("lui-disabled");&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; });&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;When the paint methods is executed the first time, the first console.log prints out the individual checkbox of each extension. However, when I click the checkbox in the second extension, the action is performed in the first. In the console.log of the extensions ID, the ID of the first extension is printed, not of the one I clicked the checkbox in.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; I thought using $element ensured that the code would operate within the specific instance of the extension, but am I missing something? How should I define the event listener I have bolded above in such way so it is applied in the specific instance of the extension?&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 14 Feb 2024 11:26:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2418729#M19907</guid>
      <dc:creator>johannaalmm</dc:creator>
      <dc:date>2024-02-14T11:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: $element not working to find ID of html-elements</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2422348#M19979</link>
      <description>&lt;P&gt;Hi &lt;SPAN style="background: var(--ck-color-mention-background); color: var(--ck-color-mention-text);"&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/205597"&gt;@johannaalmm&lt;/a&gt;&lt;/SPAN&gt; one way for fixing this is to set a unique id to your HTML. Instead of using "myCheckBox" you could concatenate your visualization ID, something like "Gthye_myCheckBox". You can get visualization ID from layout object, under l&lt;SPAN style="background-color:rgb(255,255,255);color:rgb(45,51,56);font-size:13px;"&gt;ayout.qInfo.qId)&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 14:00:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2422348#M19979</guid>
      <dc:creator>alex_colombo</dc:creator>
      <dc:date>2024-02-22T14:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: $element not working to find ID of html-elements</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2422710#M19987</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/145804"&gt;@alex_colombo&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;I have tried that, but no luck... Even with the included objectID, which is put together like:&lt;/P&gt;
&lt;P&gt;$(""+layout.qInfo.qId+"myCheckBox").find('#myCheckbox').on("change",function(e) {});&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 07:01:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2422710#M19987</guid>
      <dc:creator>johannaalmm</dc:creator>
      <dc:date>2024-02-23T07:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: $element not working to find ID of html-elements</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2422781#M19991</link>
      <description>&lt;P&gt;This is HTML stuff, not related to the extension itself. Please check your HTML code and see if you are pointing to the correct checkbox.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try to print into console &lt;SPAN style="background-color:rgb(255,255,255);color:rgb(45,51,56);font-size:13px;"&gt;$(""+layout.qInfo.qId+"myCheckBox").find('#myCheckbox') and check if you are selecting the correct HTML. Then, you can also try to use native JS intead of Jquery using &lt;/SPAN&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event" target="_blank"&gt;&lt;SPAN style="background-color:rgb(255,255,255);color:rgb(45,51,56);font-size:13px;"&gt;addEventListener&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 08:54:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/element-not-working-to-find-ID-of-html-elements/m-p/2422781#M19991</guid>
      <dc:creator>alex_colombo</dc:creator>
      <dc:date>2024-02-23T08:54:26Z</dc:date>
    </item>
  </channel>
</rss>

