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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:43:30+00:00 2026-05-31T22:43:30+00:00

Here is the FIDDLE you can fork and work on Given a list of

  • 0

Here is the FIDDLE you can fork and work on

Given a list of

<a href="#" class="iconList" id="myDoc_aaa">...</a>
<a href="#" class="iconListChecked" id="myDoc_bbb">...</a>
<a href="#" class="iconList" id="myDoc_ccc">...</a>

I want to assign the * key to trigger click on each link in turn and ctrl-* to trigger click on all. I do not want to toggle the class, since there is a script that needs to run when the link is clicked

QUESTION: Can you help me with the selectors and what else (data attribute?) to loop over the links one at a time on * and all at once on ctrl-star

So when you

hit *, the first link is triggered (and the script changes the class to iconListChecked),

hit * star again and the second link is triggered (unchecking it),

hit * and the third is triggered,

hit * and we wrap and the first is triggered (unchecking it)


hit ctrl-star and all not-checked links are triggered

FIXED: $(".iconList").trigger("click");


(My fiddle currently only handles the * on the numeric keyboard – I have a separate question for that here)

  • 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-31T22:43:31+00:00Added an answer on May 31, 2026 at 10:43 pm

    http://jsfiddle.net/GtXMW/28/

    // ... removed unedited part..
    
    // Function to handle *
    function toggleFirst() {
        var $candidates = $('.iconList,.iconListChecked');
        var $nottoggled = $candidates.not('.rw_toggled').first();
        if (!$nottoggled.length) {
            // There is no non-toggled element any more.
            // Remove class from all links
            $candidates.removeClass('rw_toggled');
            $nottoggled = $candidates.first();
        }
        // Add temporary class, trigger click
        $nottoggled.addClass('rw_toggled').click();
        console.log("*");
    }
    // Function to handle ctrl+*
    function toggleAll() {
        console.log("ctrl+*");
        $(".iconList").click();
    }    
    $(document).ready(function() {
        // Handle Ctrl+* and * 
        $(document).keypress(function(e) {
            var $this = $(this);
            if (e.which === 42) { // '*'.charCodeAt(0) === 42
                if (!$this.data('rw_star_pressed')) {
                    $this.data('rw_star_pressed', true);
                    if (e.ctrlKey) { // Ctrl + *
                        toggleAll();
                    } else {             // Just *
                        toggleFirst();
                    }
                }
            }
        }).keyup(function() {
            $(this).removeData('rw_star_pressed');
        });
    
        // ... rest of your original code...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the fiddle I'm working with: http://jsfiddle.net/Scd9b/ How can I delay the href function
Here is my fiddle: http://jsfiddle.net/jamesbrighton/wxWgG/4/ HTML: <div> <p class=click>Click 1</p> <p>This should be ignored</p>
Here is a fiddle . As you can see when a colour from the
I have a fiddle here I have multiple fieldsets and the user can also
I want to describe my idea first, check the fiddle here : There are
You can see the fiddle here: http://jsfiddle.net/easeS/4/ Here is the html/css I have: #main
I've made a very simple fiddle here , and you can check it out
I have created a fiddle here: http://jsfiddle.net/ozzy/paPRg/1/ Basically, I want to allow users to
I think an image best describes this: JS FIDDLE HERE: http://jsfiddle.net/fp2Ak/ What I want
I've created a fiddle here: http://jsfiddle.net/surfjam/zWWpz/ I can't figure out why animate works in

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.