title: JQuery - How to add click for an element only on mobile
body: <p>I have two divs with a class <code>desktop</code> and <code>mobile</code>.
  How can I add a click listener only for an element with a class <code>button</code> in a div with a class <code>mobile</code> . I try sth like</p>
  <p><code>$(&quot;.mobile .button&quot;).click(function(){...});</code> and <code>$(&quot;.mobile&quot;).find(&quot;.button&quot;).click(function() {...});</code></p>
  <pre><code>&lt;div class=&quot;parent&quot;&gt;
   &lt;div class=&quot;desktop&quot;&gt;
    &lt;div class=&quot;button&quot;&gt;
     &lt;div&gt; The same .... &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div
   &lt;div class=&quot;mobile&quot;&gt;
    &lt;div class=&quot;button&quot;&gt;
     &lt;div&gt; The same .... &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div
  &lt;div&gt;
  
  </code></pre>