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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:00:38+00:00 2026-05-29T07:00:38+00:00

Well, I am storing variables inside of a class that will be used for

  • 0

Well, I am storing variables inside of a class that will be used for other elements. Might not be the best approach for this, but is easier to do when I grab the element using $("tr").each(function{ // code }); Perhaps there is a better attribute to store these variables in?? Or a better overall way of doing it?

But basically, I am trying to use the markRow: text as a beginning string to the variable that I need to determine if this tr element has within it’s class. If it has the text “markRow:”, I than need to split(":"), only this class (because the tr elements can have more than 1 class defined on them), into an array and only grab the 2nd array bound. Than, after I use these variables, I need to wipe out all classes from each tr element that has markRow: defined within the class, but don’t want to remove any other classes that these tr elements might have within them when doing this.

Can someone please get me started on this? Was thinking of the selector :contains for a partial match for the markRow: string, but not sure if this is any good. Perhaps using filter somehow might help?

  • 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-29T07:00:38+00:00Added an answer on May 29, 2026 at 7:00 am

    Based on my understanding of your problem here is what you can try.

    $('tr').each(function(){
       var $tr = $(this), classes = $tr[0].className, finalClasses = [];
    
       //If className contains 'markRow:' then process it
       if(classes.indexOf('markRow:') != -1){
           $.each(classes.split(' '), function(i, class){
              //If class does not contain `markRow:' 
              //then add this class else ignore it
              if(class.indexOf('markRow:') == -1){
                 finalClasses.push(class);
              }
           }); 
           //Finally combine all the classes not containing `markRow:` 
           //and set it to tr
           $tr[0].className = finalClasses.join(' ');
       }
    }); 
    

    Keeping your problem aside I would suggest you to use data attributes to pass on data along with element on the page. It becomes very easy to retrieve data from data attributes.

    E.g.

    <div data-info="someInfo" id="div1"></div>
    

    To get data-info attribute value from div1 element you can use the below code.

    var info = $('#div1').data('info');
    

    To set data-info you can use this code

    $('#div1').data('info', 'someInfo');
    

    .data() reference: http://api.jquery.com/jQuery.data/

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

Sidebar

Related Questions

Is there a idiomatic way of removing elements from PATH-like shell variables? That is
Well, I have a lot of variables in javascript that I need get the
Well, I am wondering about a thing with rounding decimals, and storing them in
Well, This is a string I get from a web service: Tuesday, March 30,
well, this works great on a non Windows Mobile: string user = WindowsIdentity.GetCurrent().Name.ToString(); but,
I have a query that returns a string, as well as an escape character
I'm trying to write a recursive function that would get some string, as well
Well, I need get two values that represents the distance between two full dates-only
Why should I declare local variables as 'static' inside a method? Like: static NSString
I need some clearance on scope of instance variables in rails application (not sure

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.