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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:13:04+00:00 2026-05-30T17:13:04+00:00

I am trying to create a simple function that can take a parameter and

  • 0

I am trying to create a simple function that can take a parameter and pass it into a .toggle() event. This page contains potentially hundreds of individual toggle events. I want one function to handle all of these events.

 function toggleVehicles(partId) {
$("#"+partId+"vehicles").fadeToggle('fast');
}

The function is called from clicking on a table row:

<tr id="<? echo $id; ?>Control" onClick="showVehiclesbyPart(<? echo $id; ?>); toggleVehicles(<? echo $id; ?>)" class="list">

The function showVehiclesbyPart is the AJAX data collection, followed by the function in question here.

The function works, except that when initially clicked, the toggle doesn’t execute properly. It looks as though it’s toggling out and back in instantly. Any clicks that follow will toggle the div correctly.

I looked into some other posts concerning similar issues, and binding was mentioned. I’m new to jQuery and Javascript, and I can’t seem to find what I feel is probably an easy fix.

The page is located at http://www.partsconsign.com. Expand a category and click on a part number record to see the issue.

  • 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-30T17:13:05+00:00Added an answer on May 30, 2026 at 5:13 pm

    Your problem is that your table rows that display your vehicle parts is initially displayed. When you click the first time, it loads the data, then toggles from:

    display: table-row; 
    

    to

    display: none;
    

    Change these rows to display: none; on page load, so when they’re first clicked, they will toggle to show and not hide.

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

Sidebar

Related Questions

I'm trying to create a simple program or function that will take the users
I am trying to create a simple page that enters data in to a
Update I'm trying to create a simple Go function which will simply take in
I'm trying to create simple function that will work two ways. Basically, when I
I'm trying to create a simple function which returns me a date with a
I'm trying to create a simple custom validator for my project, and I can't
Im trying to create a simple loop that creates 50 buttons, adds them to
I'm trying to create a simple prototype in JavaScript that removes a character from
I'm trying to create a simple AJAX uploader (as i know you can't actually
I am trying to create a simple script that gives me the next recycling

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.