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 a fiddle where I can't get it to work http://jsfiddle.net/mjmitche/rAPcQ/22/ I have html
Here's my fiddle: http://jsfiddle.net/e6kCH/15/ It may sound stupid, but I can't find a way
Here is the fiddle: fiddle Basically I want to include and accordion menu using
Here is my fiddle: http://jsfiddle.net/jamesbrighton/wxWgG/4/ HTML: <div> <p class=click>Click 1</p> <p>This should be ignored</p>
JSfiddle: http://jsfiddle.net/ybZvv/57/ I have a fiddle here where the user can append row and
Fiddle can be found here . I'm adding to an observable array which is
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
Here's a fiddle: http://jsfiddle.net/vBt5E/ I want to pause and unpause an endlessly scrolling jquery
I've got my fiddle here, but I can't understand why it's not calling my

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.