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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:18:49+00:00 2026-05-27T10:18:49+00:00

today I have been asking here for help with this script . It was

  • 0

today I have been asking here for help with this script.

It was successfully done – thanks again to RKW.

I’ve merge the code with my previous one, and everthing seems working well – under FF. But now, I’ve tryed it under Chrome, Safari (mac) and Opera.
In Chrome and Safari the script isn’t doing enything at all (and the error console stay clear). Under opera only the first part is working – the class active is added.

Any suggestions?

$(document).ready(function(){
    $('input').focus(function() { /* add class active to parent div */
        $('div').removeClass('active');
        $(this).parent().parent().parent().addClass('active');
        $(this).closest("div").addClass('active');
    });

    $('input:radio').focus(function() { /* add class highlight to specified tds in one column */
        var num = 2;
        var col = $(this).closest('td').index() + 1;
        var row = $(this).closest('tr').index();

        var tds = $('td:nth-child(' + col + ')');
        tds = tds.slice(row,row+num);

        $('td').removeClass('highlight');
        tds.addClass('highlight');
    });
});
  • 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-27T10:18:50+00:00Added an answer on May 27, 2026 at 10:18 am

    I’m not too sure what you are trying to do with your highlight class (as in how/what it should highlight) however, there are a few changes you need to make to properly apply the classes to the divs.

    Instead of using .focus(), you’ll want to use:

    $('input').click(function()
    

    and

    $('input:radio').focus(function()
    

    One note about input:radio is that it will have to use jQuery’s engine to find the radio buttons since it is not a standard CSS2/3 selector. If speed of execution is crucial, use Thiago Santos’ type=’radio’ (since CSS understands this, so will your browser).

    The other thing I’ve changed is this:

    $('div').removeClass('active');
    

    Since it didn’t find the divs in chrome, however to do the same thing in a page when I was messing with transforms, I found all the elements that used the .active class and removed them from all elements before setting $(this) element with the tag. Changing it to:

    $('.active').removeClass('active');
    

    JSFiddle Example

    I also noticed you were using CSS’ nth-child, please note that this does not work for IE8 or less (or IE9 in quirks mode).

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

Sidebar

Related Questions

I have been using Hibernate very successfully, but today I noticed a bizarre phenomenon
I have been using Perl for some time, but today I came across this
I have been racking my brain over this all day today. I have the
hello I am new here and in programming as well. Today I have been
I've been asking similar questions here today, but I'm seeing I think the issue
I have been given a w2k3 server today that is running IIS 6. This
I have been using pil for the first time today. And I wanted to
I have been trying to use Ninject today and have a couple of questions.
Have a have a Windows VPS using Plesk 9. Until today I have been
Today I have come across a surprising definition of a metaclass in Python here

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.