Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7439307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:41:15+00:00 2026-05-29T10:41:15+00:00

I have the code live here(JSFiddle) : Jquery does not hide the label on

  • 0

I have the code live here(JSFiddle):

Jquery does not hide the label on keypress.

JQUERY:

$(document).ready(function(){
$('input').keypress(function(){
$(this).closest('label').hide();
});
});

HTML:

<div id="login">
<h2 style="font-size:18px;">Login</h2>

<form method="post" id="user_new" class="user_new" action="/users/sign_in" accept-charset="UTF-8"><div style="margin:0;padding:0;display:inline"><input type="hidden" value="✓" name="utf8"><input type="hidden" value="CFIZzyFucEG03h33m6dzX9DNy/Ux11yjShcT2xZnZRs=" name="authenticity_token"></div>
  <p style="position: relative; float: left; margin-bottom: 0px;"><label style="position:absolute;margin:0px;top:10px;left:20px;color:#CCCCCC;" for="user_email">Email</label>
  <input type="email" value="" size="30" name="user[email]" id="user_email">
  </p>

  <p style="position: relative; float: left; margin-top: 5px;"><label style="position:absolute;margin:0px;top:10px;left:20px;color:#CCCCCC;" for="user_kodeord">Kodeord</label>
  <input type="password" size="30" name="user[password]" id="user_password">
  </p>

    <p><input type="hidden" value="0" name="user[remember_me]"><input type="checkbox" value="1" name="user[remember_me]" id="user_remember_me"> <label for="user_Husk_mig">Husk mig</label></p>
  <p><input type="submit" value="Login" name="commit" id="user_submit"></p>
<div style="    display: block;
    float: left;
    margin-top: 20px;
    width: 400px;margin-left: -20px;">
  <a href="/users/sign_up">Sign up</a><br>

  <a href="/users/password/new">Forgot your password?</a><br>



</div>
</form></div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:41:16+00:00Added an answer on May 29, 2026 at 10:41 am

    It’s unclear what part of your HTML you’re referring to, but to select <label> elements next to your input, you need to use $.prev() for immediately previous elements and $.next() for elements immediately after your input.

    $.closest() selects the closes parent of the element, not the “physically” closest element in the DOM, which is why your <label> isn’t being hidden; it’s not selected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code which works. $(document).ready(function(){ $('form').live('submit', function(){ // have to do it
I have this js code: $(#startSearch).live(click, function(event) { $(input:checkbox[name='searchId']:checked).each(function() { var searchId = $(this).val();
My code is available below, and here: http://jsfiddle.net/fRpCy/ var input = []; input.push($('input')); $(input).live('keydown',
I have the following bit of code, simply: $(function() { $('a.add-photos-link').live('click', function(e) { $(this).colorbox({
i have the following block of code: $(#contact_container form, #contact_details form).live( submit, function(event) {
I have a simple jQuery function: $('#selectable1 span').live('mousedown', function() { var ff = $(this).css(font-family);
Here my JS code $(function () { $(.button).live(click, function () { alert(Dialog page function
LIVE CODE: http://jsfiddle.net/nnMYN/ I have to automatically copy the postal address to the home
Here is a live example of my problem http://jsfiddle.net/littlesandra88/xksB9/ I would have expected that
i have a fairly simple dropdown I build. Here is the live example: http://jsfiddle.net/K8VtB/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.