title: id selector is not working but class selector is working. Using Variable in the selector
body: <p>This is not working when I try to use id selector:</p>
  <pre><code>$(&quot;&lt;div&gt;&quot;,{id:&quot;o&quot;+i,&quot;class&quot;:&quot;overlay&quot;}).appendTo(&quot;#&quot;+i);
  $(&quot;&lt;div&gt;&quot;,{id:&quot;te&quot;+i,&quot;class&quot;:&quot;text&quot;}).appendTo(&quot;.overlay&quot;);
  $(&quot;#te&quot;+i).html(id);
  </code></pre>
  <p>But this is working when I use class selector:</p>
  <pre><code>$(&quot;&lt;div&gt;&quot;,{&quot;class&quot;:&quot;overlay&quot;}).appendTo(&quot;#&quot;+i);
  $(&quot;&lt;div&gt;&quot;,{&quot;class&quot;:&quot;text&quot;}).appendTo(&quot;.overlay&quot;);
  $(&quot;.text&quot;).html(id);
  </code></pre>
  <p>My Frame looks like this:</p>
  <pre><code>&lt;div class = &quot;GalleryandRate&quot; id = &quot;GalleryandRate&quot;&gt;
    &lt;div id=&quot;gallery&quot; onload=&quot;mygallery()&quot;&gt;
      &lt;div class=&quot;movie&quot;&gt;
        &lt;img src=&quot;SX300.jpg&quot; alt=&quot;poster&quot; width=&quot;250&quot; height=&quot;350&quot;&gt;
        &lt;div class=&quot;overlay&quot;&gt;
          &lt;div class=&quot;text&quot;&gt;a variable&lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;title&quot;&gt;scooby doo&lt;/div&gt;
        &lt;button class=&quot;nominate&quot; &gt;&lt;i class=&quot;fa fa-plus-circle&quot;&gt;&lt;/i&gt; Nominate &lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;div id=&quot;rate&quot;&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Thank you</p>
  <p>UPDATE:</p>
  <p>Since people asking why not set text when create element. There is a loop, for each movie in json data, each where have one specific description on overlay effect on the poster.The text element's innerhtml will be that description for that one movie.</p>
  <p>Detailed code can be seen at <a href="https://github.com/UneSaltedFish/Nominate_Movie" rel="nofollow noreferrer">https://github.com/UneSaltedFish/Nominate_Movie</a> it is also hosting on <a href="https://unesaltedfish.github.io/Nominate_Movie/" rel="nofollow noreferrer">https://unesaltedfish.github.io/Nominate_Movie/</a> for view what I mean by overlay effect when put cursor on the picture.</p>