# Other Languages > jQuery >  [RESOLVED] Click Button Event Always Firing

## FunkySloth

I'm just wondering why this alert method in Click Event always firing when I'm selecting my select element.



```
        $('#Register').click(function () {

            if ($('#account_type').val() == "def") {
                alert('Please select an account type.');
                return;
            }
        });
```




```
<select id="account_type" class="form-control login-type" onchange="AccountType()">
</select>
```

----------


## PlausiblyDamp

What is the code for the AccountType function?

----------


## Shaggy Hiker

_Thread moved to JQuery forum, since the language appears to be JQuery._

----------


## FunkySloth

This is the code for AccountType Function:



```
        function AccountType()
        {
            switch ($('#account_type').val()) {
                case "def":
                    HideContent();

                    break;
                case "app":
                    ShowContent();

                    $('#FNAME').css('display', 'block');
                    $('#MNAME').css('display', 'block');
                    $('#LNAME').css('display', 'block');
                    $('#EMAIL_ADDRESS').css('display', 'block');
                    $('#PASSWORD').css('display', 'block');

                    break;
                case "emp":
                    ShowContent();

                    $('#FNAME').css('display', 'block');
                    $('#MNAME').css('display', 'block');
                    $('#LNAME').css('display', 'block');
                    $('#EMAIL_ADDRESS').css('display', 'block');
                    $('#PASSWORD').css('display', 'block');

                    break;

                default:
                    HideContent();
                    break;
            }
        }
```

----------


## FunkySloth

Found the line of code that made the unusual behavior of the button click. There are two elements with the same Register id.

----------

