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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:48:27+00:00 2026-06-06T23:48:27+00:00

This is my code : <a href=javascript:void(0); id=apri-menu> <span>First</span> <span style=display:none;>Second</span> </a>​ $(‘#apri-menu’).click(function ()

  • 0

This is my code :

<a href="javascript:void(0);" id="apri-menu">
    <span>First</span>
    <span style="display:none;">Second</span>
</a>​

$('#apri-menu').click(function () {
    $(this).find('span').first().hide().end().find('span').last().show();
    $('#menu-nascosto').show();
});​

clicking on the link I’d aspect to show the second span, but seems that .end() make some pain.

Where am I wrong?

  • 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-06T23:48:28+00:00Added an answer on June 6, 2026 at 11:48 pm

    What .end() does is “return the jQuery object to its previous selection state”. In your example, the last operation that modifies the matched objects is .first(), so .end() rewinds time back to just before that — after .find('span'). So the end result is as if you had written

    $(this).find('span').find('span').last().show();
    

    …which will obviously not work because there are no nested <span>s in your markup.

    Simply getting rid of the second .find() will fix things.

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

Sidebar

Related Questions

I have this code : HTML: <a id=openDiv href=javascript:void(0);>Show</a><br /><br /> <div id=control style=display:none;>
Using this jquery code: <a href=javascript:void(0) id=m1>Get Selected id's</a> jQuery(#m1).click( function() { var s;
how to insert this javascript code : thejavascript <A HREF=javascript:void(0) onclick=window.open('welcome.html','welcome')> </A> inside img
I have this code: HTML <div class=box_meteo> <div class=box_meteo_pulsanti> <a href=javascript:void(0); class=box_meteo_pulsante id=meteoButton1>Link</a> </div>
I have this code : <a href=javascript:void(0) id=0 class=hp_nav_label>0</a> <a href=javascript:void(0) id=1 class=hp_nav_label>1</a> <a
This is my code: <script> document.getElementById(div').innerHTML = '<a href=javascript:void(0); onclick=openPhpFile (\'asdasD\\Asdeqw.txt\');>efff</a>'; </script> When the
For some reason, this line of code is returning undefined for $(this).attr(href) $(a).attr(href, javascript:page('
I have an html page with a link like this: <a href=javascript:window.print()>Print QR code</a>
So, this code splits the screen into two frames: Javascript:A14nH=location.href;L3f7=http://www.google.com;R1Gh7=http://www.google.com;if(L3f7&&R1Gh7){Fr4Q='<frameset%20cols=\'*,*\'>\n<frame%20src=\''+L3f7+'\'/>';Fr4Q+='<frame%20src=\''+R1Gh7+'\'/>\n';Fr4Q+='</frameset>';with(document){write(Fr4Q);void(close())}}else{void(null)} I need to run
I have a string that looks like this: <td width=308>Services Needed: <a href=javascript:void(null); title=weekly

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.