简体   繁体   中英

Jquery not removing class on keyup event

Im trying to hide a div and show another on a keyup event. It doesn't work I don't know why:

<div class = "beta_form">
<form id = "beta_form" class = "form-horizontal">
    <label for="beta_password" class = "control-label">
    </label>
    <input id = "beta_password" name = "beta_password" type = "text" class = "form-control">
</form>
</div>

<div class = "facebook_twitter hidden">
  <a class="btn btn-block btn-social btn-facebook">
    <i class="fa fa-facebook"></i> Inicia sesión con Facebook
  </a>
</div>


$("#beta_password").keyup(function(){
    if ($(this).val() === '1789'){
        $("#facebook_twitter").removeClass("hidden");
        $("#beta_form").addClass("hidden");
    }
});

Thanks in advance for your help.

$("#facebook_twitter")

is supposed to be

$(".facebook_twitter") 
  • class selector

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM