Better way of writing this block of jquery code
I've the following code block that works just as expected, but I'm sure there's a better and cleaner way to write it. Would appreciate if you could show me how -
- $(function () {
- $("#show_only_to").bind('change', function () {
- if( $("#show_only_to").val() == 'loggedin') {
- $("#access_redirect").hide();
- $("#access_member_roles").show();
- } else if ( $("#show_only_to").val() == 'loggedout' ) {
- $("#access_member_roles").hide();
- $("#access_redirect").show();
- } else if ( $("#show_only_to").val() == 'everyone' ) {
- $("#access_member_roles").hide();
- $("#access_redirect").hide();
- }
- });
- });