How can I shorten this function, so I don't need any of these `if`?

```
function showhide(element) {
    $('body').on('click', '#'+element, function() {
        if(element == 'export') {
            $('.chat-export').toggle();
            $('.chat-settings').hide();
            $('.chat-users').hide();

        } else if(element == 'settings') {
            $('.chat-export').hide();
            $('.chat-settings').toggle();
            $('.chat-users').hide();

        } else if(element == 'users') {
            $('.chat-export').hide();
            $('.chat-settings').hide();
            $('.chat-users').toggle();
        }
    });
}

```
['https://Stackoverflow.com/questions/26085466', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/718990/']
Just do this:

```
$('[class^=chat]').each(function(){
   if($(this).attr("class").indexOf(element) > -1){  $(this).toggle();   }
   else { $(this).hide(); }
});

```

PS. The problem with my early code and antyrat's code is that when we hide everything, the toggle works unexpectedly.

[**DEMO**](http://jsfiddle.net/f3avLu2o/1/)
You can avoid this using this [`regex`](http://james.padolsey.com/javascript/regex-selector-for-jquery/) selector snippet for example:

```
$( 'div:regex(class, .chat-*)' ).hide();
$( '.chat-' + element ).toggle();

```