0

Please take a look at this page. I wrote click functions for each button (#signup_switch_btn and #signin_switch_btn, the big red and green ones) on this page but no one responds. http://tural.no-ip.org/ - Page in action. JS file - first.js

Js looks like this

$(document).ready(function () {
    $('#signup_form').get(0).reset()
    var counter = 0,
signin = $("#signin_switch_btn"), 
signup = $("#signup_switch_btn"), 
signin_f = $("#signin_form"), 
holder = $("#holder"), 
signup_f = $("#signup_form"), 
f_container = $("#form_container");


    function beforeAnimation() {
        signin.removeClass('default_radius').addClass('right_radius');
        signup.removeClass('default_radius').addClass('left_radius');
        $("#container").animate({
            marginTop: "-=150px",
        }, 500);
    }


    $("#signup_switch_btn").click(function () {

        if (counter === 0) {
            beforeAnimation();
            holder.css('backgroundColor', '#f91c06').height(275).slideDown("slow");
            f_container.show();
            signup_f.stop(true, true).fadeIn(1200);
        } else {
            holder.stop(true, true).animate({
                height:"275",
                backgroundColor:"#f91c06"
            },1000);
            signin_f.stop(true, true).fadeOut(1000);
            f_container.stop(true, true).animate({
                height:"260"
            },1000);
            signup_f.stop(true, true).fadeIn(1000);
        }
        counter++;
    });

    $("#signin_switch_btn").click(function () {
        if (counter === 0) {
            beforeAnimation();
            holder.css('backgroundColor', '#5bd300').height(125).slideDown("slow");
            f_container.show();
            signin_f.stop().fadeIn(1200);
        } else {
            holder.stop(true, true).animate({
                height:"125",
                backgroundColor:"#5bd300"
            },1000);
            signup_f.stop(true, true).fadeOut(800);
            f_container.stop(true, true).animate({
                height:"110"
            },1000);
            signin_f.stop(true, true).fadeIn(1200);

        }

        counter++;
    });

    $('input[type="text"],input[type="password"]').focus(function () {
        labelFocus(this, true);
    }).blur(function () {
        labelFocus(this, false);
    });

    function labelFocus(el, focused) {
        var name = $(el).attr('name');
        $('label[for="' + name + '"]').toggleClass('focused', !! focused);
    }
    $('input[type="text"],input[type="password"]').keypress(function () {
        $(this).attr('class', 'valid');
    }); 

});

3 Answers 3

3

No element with an id of signup_switch_btn exists in that page. Therefore the following binding will never work:

$("#signup_switch_btn").click
Sign up to request clarification or add additional context in comments.

4 Comments

the backend is php, I changed php file. Is tere any chance that the php cache didn't update yet?
Yes, that is certainly possible. Or possibly the browser is caching. Try using ctrl+f5 to force a full page refresh.
please refresh the page and press on red button. What is that?
That's a broken button. The red button's href is empty, it just looks like href, change it to href="#". Once I did that in Chrome Dev Tools it started working.
1

There are no buttons with id *signin_switch_btn* and *signup_switch_btn*. Your button's ids are signin and signup.

2 Comments

That's how php side looks <div id="buttons"> <a href="" id="signup_switch_btn" class="button red gradient default_radius">Qeydiyyatdan keç</a> <a href="#" id="signin_switch_btn" class="button green gradient default_radius">Daxil ol!</a> </div> . Is tere any chance that the php cache didn't update yet?
please refresh the page and press on red button. What is that?
1

Your id on the html page are signing and signup. Change $('#signup_switch_btn') to $('#signup')

2 Comments

That's how php side looks <div id="buttons"> <a href="" id="signup_switch_btn" class="button red gradient default_radius">Qeydiyyatdan keç</a> <a href="#" id="signin_switch_btn" class="button green gradient default_radius">Daxil ol!</a> </div> . Is tere any chance that the php cache didn't update yet?
please refresh the page and press on red button. What is that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.