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 8838409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:59:15+00:00 2026-06-14T09:59:15+00:00

Any idea how I can show/hide only the child ‘.link’, from each list item,

  • 0

Any idea how I can show/hide only the child ‘.link’, from each list item, when the relevant input field is focused/blurred.

Something like the following, but I’m unsure how to apply (this) to it?

$('.input').focus(function () {
  $('li').next('.link').show();
});

$('.input').blur(function () {
  $('li').next('.link').hide();
});

Markup:

<ul>
   <li>
     <input class="input" value="1">
   </li>

   <li">   
     <a class="link" href="#"></a>         
   </li>
 </ul>

 <ul>
   <li>
     <input class="input" value="2">
   </li>

   <li>   
     <a class="link" href="#"></a>         
   </li>
 </ul>
etc.
  • 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-06-14T09:59:16+00:00Added an answer on June 14, 2026 at 9:59 am

    The following assumes the structure of your markup is not going to change. You can use .parent() to get the parent element, .next() to get the following sibling, and .children() to get a child element. You can combine both event handlers into one, and improve efficiency by delegating the event handler higher up the DOM tree:

    $("ul").on("focus blur", ".input", function (e) {
        var method = e.type === "focusin" ? "show" : "hide";
        $(this).parent().next().children(".link")[method]();
    });
    

    Note that the event type check is looking for focusin – jQuery appears to actually bind to focusin and focusout rather than focus and blur.

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

Sidebar

Related Questions

I don't have any idea how can I create a custom UIPickerView with an
Any idea on how can I track users bookmarking event? I want to find
Any idea why I can't see H1? <div id=getTheProducts style=clear: both; margin-top: 15px; margin-bottom:
any idea how i can get the code below to produce this output? 1
Any idea how I can tell AutoMapper to resolve a TypeConverter constructor argument using
Any idea how one can bind binary data to a ComponentOne WebReport control?
Any idea how I can draw Bullet Points using Flex? instead of using image
can any body suggest me any idea about how can i compare two fields
Does anyone have any idea on how can you create a product filtering query
Does anyone have any idea if you can find source JARs on Maven repositories?

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.