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

  • Home
  • SEARCH
  • 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 7582721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:30:18+00:00 2026-05-30T18:30:18+00:00

I have a HTML anchor that when clicked should make a div slide up

  • 0

I have a HTML anchor that when clicked should make a div slide up or down (I call JQuery’s .slideToggle(); function);

My Problem: When I click the link, instead of executing code, it goes to a new page, where the url is the javascript code, in my case, “javascript: $('#attachFileContainer').slideToggle();” and the contents of the page(body) is simply “[object Object]“.

My Code:

<a class="interactiveLink" 
     href="javascript: $('#attachFileContainer').slideToggle();">Attach File</a>

What is going wrong, I have had many anchor elements where I call javascript from the href attribute and this have never happened?

  • 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-30T18:30:19+00:00Added an answer on May 30, 2026 at 6:30 pm

    You want this:

    <a class="interactiveLink" onclick="$('#attachFileContainer').slideToggle(); return false;" href="#">Attach File</a>
    

    The return false prevents the link from doing anything after the onclick stuff runs.

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

Sidebar

Related Questions

I have downloaded the jquery scroll script (http://www.position-absolute.com/articles/better-html-anchor-a-jquery-script-to-slide-the-scrollbar/) which will scroll to your anchor
I have html code that looks roughly like this: <div id=id1> <div id=id2> <p>some
I have the following jQuery event that gets fired every time an anchor is
I'm working with jquery. I have an anchor tag that is generated dynamically in
I have an anchor tag in my HTML that is used for a javascript
I have an named HTML anchor tag that works like a bookmark. This tag
Sorry about the wording for my question title. I have a basic HTML anchor
I have a HTML fragment which contains two anchor tags in various parts of
I have HTML that includes symbols such as the Trademark TM as superscript (™).
I have HTML code like this : <div> <a>Link A1</a> <a>Link A2</a> <a>Link A3</a>

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.