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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:41:27+00:00 2026-05-24T12:41:27+00:00

Here’s hoping someone can give me a hand will a small JavaScript issue I’m

  • 0

Here’s hoping someone can give me a hand will a small JavaScript issue I’m having. I’ve done a fair bit of troubleshooting and consulting Google to no avail.

I have a series of links that when clicked trigger two events:

a) Change the class on the link (works perfectly).
b) Change the class on around 10 divs (works partially).

The floated divs are generated by loop and are output to the right of the link.

What I’m struggling with is a clean piece of Javascript which will change the class on the link and div at the same time. I’m using the following:

$(document).ready(function() {
$("#row1_label").click(function() { $("#row1_label, #row1_cell*").toggleClass("active"); });
});

This works well when I want to change the class on a small number of elements but it far from scalable.

Can anyone suggest I can get the Javascript to recongise the ‘*’ as a wildcard and change the class based on the row ID? Basically… On click, any link or div starting with ‘row1’ get’s THIS class.

Thanks!

RRfive


Sorry, forgot to include the HTML.

<div class="leftColumn">
            <div class="logo"><a href="index.php"><img src="images/img_logo.png" width="95" height="66" alt="Two Skinny Men"></a></div>
            <div class="leftContent">
                <h3>Client:</h3>
                <h2>Client</h2>
            </div>
            <?php include("includes/inc_key.php"); ?>
            <div class="rowLabel">
                <a href="javascript: void(0)" id="row1_label"><div class="cellInner"><div class="cellCentre">Active Users<br /><span>(Forecast)</span></div></div></a>
                <a href="javascript: void(0)" id="2"><div class="cellInner"><div class="cellCentre">App &amp; Product Releases</div></div></a>
                <a href="javascript: void(0)" id="3"><div class="cellInner"><div class="cellCentre">Resource Plan</div></div></a>
                <a href="javascript: void(0)" id="4"><div class="cellInner"><div class="cellCentre">Ecosystem releases</div></div></a>
                <a href="javascript: void(0)" id="5"><div class="cellInner"><div class="cellCentre">Project Milestones</div></div></a>
                <a href="javascript: void(0)" id="6"><div class="cellInner"><div class="cellCentre">Savings Forecast<br ><span>(Time/Cost)</span></div></div></a>
            </div>
            <div class="copyright"><span>&copy;</span> <?php echo date("Y"); ?> Two Skinny Men</div>

        </div>

        <div id="main">
            <div class="container1">
                <div id="slider">
                    <?php             
                        $result = mysql_query("SELECT * FROM strategy_monthData");
                        while($row = mysql_fetch_array($result)) {
                        echo "<div class=\"month\">
                            <div class=\"inner\">
                            <div class=\"graph\"></div>
                                <h4>" . $row['title'] . "</h4>
                                <div class=\"row\" id=\"row1_" . $row['monthID'] . "\"><div class=\"rowInner\"><div class=\"rowCentre\">" . number_format($row[row_users], 0, '.', ',') . "</div></div></div>
                            </div>
                            <div class=\"clearer\"></div>
                        </div>"; }
                    ?>
                </div>
                <div class="clearer"></div>
            </div>
        </div>
  • 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-24T12:41:28+00:00Added an answer on May 24, 2026 at 12:41 pm

    You can use starts with selector.

    Try this:

    $(document).ready(function() {
        $("#row1_label").click(function() { 
            $("[id^='row1'").toggleClass("active"); 
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the issue I am having: I have a large query that needs
Here is the scenario: I'm writing an app that will watch for any changes
I used javascript for loading a picture on my website depending on which small
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here is my javascript code for a cursor focus function to go to username
Here is my code sample, let me know if it can be further improved?
Here is my question. I am having this simple menu. <div id=menu> <ul> <li>
Here's the situation, i want to have a user that can enter time on
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form

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.