JQuery event .on('click' not firing

The JQuery event on click is not firing with the following code:

core.js

$(document).ready(function() {
    $('.login-form-input').on('click', function(){
        alert("s");
        $('#login-description').css({color: #000;}).fadeIn(1000);
    alert("s");
    });  
}

index.php

http://pastebin.com/khHZS3HN

Upvotes: 0

Views: 100

Answers (4)

harshboss
harshboss

Reputation: 276

  $('.login-form-input').click(function () {
    alert("s");
    $('#login-description').css({color: #000;}).fadeIn(1000);

alert("s");
});  

Upvotes: 0

eightyfive
eightyfive

Reputation: 4711

This line is wrong:

$('#login-description').css({color: #000;}).fadeIn(1000);

It should be (-> {color: "#000"}):

$('#login-description').css({color: "#000"}).fadeIn(1000);

Upvotes: 1

Reinstate Monica Cellio
Reinstate Monica Cellio

Reputation: 26143

You've got this in your page...

<script type="text/javascript" src="js/core.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

That includes your script, core.js, before it includes jQuery. Your script requires jQuery so it should be the other way round...

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="js/core.js"></script>

Also, as pointed out by reyaner in the question comments, you need quotes around the colour...

$('#login-description').css({ color: "#000" }).fadeIn(1000);

Upvotes: 2

Roy M J
Roy M J

Reputation: 6938

This should work for you :

jQuery should be added before the click function and all codes.

<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.transit/0.9.9/jquery.transit.min.js"></script>


$(document).on("click", ".login-form-input ", function(e){
    alert("s");
    $('#login-description').css({color: "#000"}).fadeIn(1000);
    alert("s");
});

Upvotes: 1

Related Questions