title: get parent element by class using jquery
body: <p>I have following html structure for example. </p>
  
  <pre><code>&lt;div class="message" data-id="4"&gt;
          &lt;div&gt;
              &lt;div class="msg-button"&gt;
                  &lt;span class="sms"&gt;&lt;/span&gt;
              &lt;/div&gt;
              &lt;div&gt;
                  &lt;div&gt;
                      &lt;div&gt;
                          &lt;span class="sms"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>When i click on elements with class <code>sms</code> i need to get data-id attribute of element with class <code>message</code>. </p>
  
  <p>What i've done using jquery. It doesn't work for me. How can i get parent element by class?
  Thanks in advance!</p>
  
  <pre><code>$('.sms').click(function(){
      var id = $(this).parent('.msg-button').siblings('.message').data("id");
      alert(id);
  })
  </code></pre>