[RESOLVED] Click Button Event Always Firing
I'm just wondering why this alert method in Click Event always firing when I'm selecting my select element.
Code:
$('#Register').click(function () {
if ($('#account_type').val() == "def") {
alert('Please select an account type.');
return;
}
});
Code:
<select id="account_type" class="form-control login-type" onchange="AccountType()">
</select>
Re: Click Button Event Always Firing
What is the code for the AccountType function?
Re: Click Button Event Always Firing
Thread moved to JQuery forum, since the language appears to be JQuery.
Re: Click Button Event Always Firing
This is the code for AccountType Function:
Code:
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;
}
}
Re: Click Button Event Always Firing
Found the line of code that made the unusual behavior of the button click. There are two elements with the same Register id.