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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:11:59+00:00 2026-06-18T12:11:59+00:00

jQuery is doing something strange for me: it just doesn’t work and hides the

  • 0

jQuery is doing something strange for me: it just doesn’t work and hides the div only for split a second. What am I doing wrong?

The code in question, as simple as can be.

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Experiment</title>
<script type="text/javascript" 
           src="http://code.jquery.com/jquery.min.js"></script>
</head>
<body>
<script>

        function doHiding() {
           $("div.thread").each(function() {
                    $(this).hide();
           });
        }


</script>
<a href="" onClick="doHiding()">Hide</a>

<div class="thread">I like trains.</div>
</body>
</html>

I am using Chromium on Linux. I see the div dissapear for split a second, but it appears again immediately.

  • 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-18T12:12:00+00:00Added an answer on June 18, 2026 at 12:12 pm
     function doHiding() {
           $("div.thread").each(function() {
                    $(this).hide();
           });
          return false;
        }
    

    it is not hiding again it is the page that is being refreshed because href="" links to same page

    NB: i guess you used onClick="doHiding()" for the sake of demo only (otherwise handle your event within jquery scope)

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

Sidebar

Related Questions

Im new in jQuery so sure that i am doing something wrong :(. Matter
Ok, this is strange. I would hope it's something I'm doing wrong and not
If for example, I have some jQuery doing something simple like: $(div).fadeIn('fast'); $(div).html('Foo'); That
I'm just starting with jQuery, and having trouble doing something embarrassingly simple: using .load()
I thought this would work but obviously I am doing something wrong. I need
I referred to this page, but I must be doing something wrong: jQuery check
Obviously I'm doing something wrong. I've never been able to get .click() to work,
I must be doing something wrong, but my code is very basic, hardly even
Am I doing something wrong with the following code? I can't seem to get
I have a selectlist box in Jquery I am doing something like: $(#Deg).append(degtems); As

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.