title: How to use 'If $(this) has data-attribute'
body: <p>I'm with a little problem. I've got a few buttons, each with a different <code>data-function=""</code> attribute. I want to execute a little script to check which of the buttons has been clicked.  </p>
  
  <pre><code>&lt;a href="#" class="functionButton" data-function="blogFunctionaliteit"&gt;Blog&lt;/a&gt;
  &lt;a href="#" class="functionButton" data-function="offerteFunctionaliteit"&gt;Offerte&lt;/a&gt;
  &lt;a href="#" class="functionButton" data-function="overzichtFunctionaliteit"&gt;Offerte&lt;/a&gt;
  </code></pre>
  
  <p>I simply want a script that says  </p>
  
  <pre><code>if $(this) has &lt;data-function="blogFunctionaliteit"&gt; { }
  if $(this) has &lt;data-function="offerteFunctionaliteit"&gt; { }
  if $(this) has &lt;data-function="overzichtFunctionaliteit"&gt; { }
  else { // do nothing }
  </code></pre>
  
  <p>I've tried lots of thing, but everything doesn't seem to be working, including</p>
  
  <p><code>if ($(this).attr('data-function', 'blogFunctionaliteit') { }</code> - Which results in a yes, always, as it only checks if the object has the first parameter, instead of checking them both.</p>
  
  <p>Thanks in advance for writing the correct jQuery code or could advice me to use something else.</p>