title: How to get elements by a specific value of a custom attribute in jQuery?
body: <p>I have a custom attribute called <strong>data-role</strong> and I'd like to find all elements where <strong>data-role="content"</strong> in jQuery.</p>
  
  <p><img src="https://i.stack.imgur.com/aiApO.png" alt="enter image description here"></p>
  
  <p>I'm currently doing this with some old JavaScript code:</p>
  
  <pre><code>var elements = element.getElementsByTagName(tagName);
  for(var i=0; i&lt;elements.length; i++) {
    if(elements[i].getAttribute("data-role") == "content") {
      // does something evil
    }
  }
  </code></pre>
  
  <p><strong><em>Disclaimer:</strong> Code was not checked, just wrote it down quickly.</em></p>
  
  <p>I've got a feeling that there's an elegant 1-line solution in jQuery, but I'm a novice. And I can't sleep before I know, so perhaps you stackoverflowers can help a bro out. ;-)</p>