Reputation:
Hello I am playing with code whilst learning jQuery and I can't figure out how to make the Login button to work on first click. At the moment it works only on second click.
$('#login').on({
'click': function() {
$('#duck').attr('src', rand);
if (login_username.value !== 'Endra') {
$('.login').toggleClass('animated shake');
$('.babe').html("Hello unknown,enter a name.");
}
Upvotes: 0
Views: 677
Reputation: 153
You have a ".click" to call the function and further in your code, you have a second ".click" for your primary button.
just remove it ;)
//$('.btn-primary').on('click', function() {
$('.content').css('display', 'inline').addClass('animated flipInX'); //Change animation for login
//});
Upvotes: 1