title: Selecting divs using attribute conditions Jquery
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.sameClass{
    background-color:#3e6687;
    width:100px;
    height:100px;
    float:left;
    margin-right: 10px;
  }
  
  #first,#second{
    margin-bottom:10px;
    float:left;
  }
  
  #first{
    background-color:#8a94ae;
  }
  
  #second{
    background-color:#29375a;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="first"&gt;
  &lt;div class="sameClass" data-category="fun"&gt;&lt;/div&gt;
  &lt;div class="sameClass" data-category="boring"&gt;&lt;/div&gt;
  &lt;div class="sameClass" data-category="okay"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div id="second"&gt;
  &lt;div class="sameClass" data-category="fun"&gt;&lt;/div&gt;
  &lt;div class="sameClass" data-category="boring"&gt;&lt;/div&gt;
  &lt;div class="sameClass" data-category="okay"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;input type="button" value="Lets Do This"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Lets say I have the code above and I want to insert an image dynamically into one of those divs when a button has been clicked. I would like to check if the div has attribute class="sameClass" and attribute data-category="fun". The third condition is that this attribute has to be in div with attribute id="second".</p>
  
  <p>I want to do this with jQuery. Can anyone please help me with this.</p>