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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:20:50+00:00 2026-06-13T18:20:50+00:00

I know this is a bit silly question, but I still cannot find an

  • 0

I know this is a bit silly question, but I still cannot find an answer, perhaps I am searching the keywords are not right.

I hope someone could correct my js expression.

var id = idname;
$('#' + id).hide();

(‘#’ + id) expression has error from console, I’d like to have $(‘#variable‘) what is the right expression $('"#'+xerocon2013'"').

Thanks for someone could put me up

Update,

Sorry guys, I have dollar sign.
the error is

unrecognized expression: #[object HTMLDivElement]

I tested yesterday was fine, but just doesnt work today.. sigh. how odd.
I through my code maybe not right.

I just want to make sure my expression is correct. if there is no error with my expression then would be my code.

codes

<script type="text/javascript">
$(function(){
       $(window).bind("load", function () {
              var urlHash = window.location.href.split("#")[1];
                $('html,body').animate({ scrollTop: $('#' + urlHash).offset().top}, 1000);
    }); 
});
    </script>

<style type="text/css">
.space{height:800px;}
#anchor{font-size:25px;height:800px;display:block;}
</style>



<div class="space"></div>
<div id="anchor">This is anchor</a>

Thanks everyone.

  • 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-13T18:20:52+00:00Added an answer on June 13, 2026 at 6:20 pm

    So with the error, the issue would be the fact that the hash is not being returned. So if there is no hash, you are looking for an element with $(“#”)

    var urlHash = window.location.href.split("#")[1];
    $('html,body').animate({ scrollTop: $('#' + urlHash).offset().top},
    

    the window.location has a hash property, so there is no reason to split

    var urlHash = window.location.hash;
    if (urlHash.length>1) {
        var elemPosition = $(urlHash).offset().top;
    } else {
        elemPosition = 0;
    }
    $('html,body').animate({ scrollTop: elemPosition }, 1000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this might be a bit of a 'silly' question, but sometimes, I
This is a bit of a silly question but I don't know how to
I know it's a silly question but I am a bit confused with this.
I know this is a bit bleeding edge, but here's the question anyway: Given
This might sound a bit of an odd question but I know what I
I know this question is a bit silly. I am a Java Programmer that
I know its a bit silly question, but as i am new to android
I know this may sound silly little bit, but there is no other way
I know this might be a bit of a silly question, probably doing it
I am not sure if this question is not silly, but I really want

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.