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