-
Apr 24th, 2017, 05:02 AM
#1
Thread Starter
Lively Member
[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>
-
Apr 24th, 2017, 05:32 AM
#2
Re: Click Button Event Always Firing
What is the code for the AccountType function?
-
Apr 24th, 2017, 10:56 AM
#3
Re: Click Button Event Always Firing
Thread moved to JQuery forum, since the language appears to be JQuery.
My usual boring signature: Nothing
-
Apr 24th, 2017, 08:15 PM
#4
Thread Starter
Lively Member
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;
}
}
-
Apr 24th, 2017, 08:21 PM
#5
Thread Starter
Lively Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|