Multiple tabbed boxes

Multiple tabbed boxes

Hello

I have several boxes on one page with two tabs. But I have to copy the code for each tabbed box and change the id #showhidebox1 when I use the code below. I think there is a more simple way to do this. Can someone please help?

$(document).ready(function() {
    $(function () {
    var tabContainers = $('#showhidebox1 > div');
   
    $('#showhidebox1 a').click(function () {
        tabContainers.hide().filter(this.hash).show();
       
        $('#showhidebox1 a').removeClass('selected');
        $(this).addClass('selected');
       
        return false;
    }).filter(':first').click();
});   

   
});

<div id="showhidebox1">
<a href="text1">button1</a>
<a href="text2">button2</a>
<div id="text1">text 1</div>
<div id="text2">text 2</div>
</div>