If somebody else are looking for the same:
I put this in the before body section:
MyTab is a class on a tablink. (probably could also be a class on a button or something else taking a click?). I found the trick to be the document ready function.
Have a look at this post: