This function needs to be clicked twice to run:

```
function myFunction(IDofObject,IDofObject2) {
   $('#' + IDofObject).click(function(){
   $('#' + IDofObject2).toggle();
})};

```

This function only needs to be clicked once:

```
$(document).ready(function(){
  $('#show-hide2').click(function(){
    $('#content_0_contentmain_3_panelActiveCampaigns').toggle();
    if ($('#show-hide2').text() == 'Hide') {
        $('#show-hide2').text('Show');
    }
    else {
        $('#show-hide2').text('Hide');
    }
  });  
});

```

How can I make the first one work by clicking only once?