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

  • Home
  • SEARCH
  • 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 7179245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:06:06+00:00 2026-05-28T17:06:06+00:00

I have li.box , li.car which are inside a $(this) which contain modified values

  • 0

I have li.box, li.car which are inside a $(this) which contain modified values and then I have box_orig, car_orig containing the original lists…

how can I replace $(this)‘s data (html data, the li’s content) with the original list, so if $(this) contains li.box then I need to replace it with box_orig‘s data

Edit:

var list              =   $("ul#list");

var box_orig    = list.children('.box');
var car_orig    = list.children('.car');

And $(this)

 $('#list li').each(function () {
     if ($.inArray($(this).attr('class'), show) == 0) {
         console.log($(this)); //-> Returns li.box / car or whatever list was selected
     }
 });

Re-edit:
Re-Re-edit:

I realized that replacing the data breaks anything, so replacing goes out of the question, just show car/box_orig instead li.car/box

                $('#list li').each(
                function(){
                    //alert($.inArray($(this).attr('class'),show) );
                    if ($.inArray($(this).attr('class'),show) == 0)
                    {
                        if($(this).attr('class') == 'box')
                        {
                             --> show box_orig, which contains lis with info BUT DO NOT REPLACE THE DATA, just show the box_orig instead of $(this) = li.box
                        }
                        if($(this).attr('class') == 'car')
                        {
                             --> show car_orig, which contains lis with info BUT DO NOT REPLACE THE DATA, just show the box_orig instead of $(this) = li.car
                        }
                        console.log($(this));
                    }

html:

jQuery(li.car)  result...rifting (line 703)
jQuery(li.car)  result...rifting (line 703)
jQuery(li.car)  result...rifting (line 703)
jQuery(li.car)  result...rifting (line 703)
jQuery(li.car)  result...rifting (line 703)
jQuery(li.car)  result...rifting (line 703)
jQuery(li.car)  result...rifting (line 703)
jQuery(li.car)  result...rifting (line 703)

and each li.car contains data (img and text)

  • 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-28T17:06:08+00:00Added an answer on May 28, 2026 at 5:06 pm

    Solution:

    var list              =   $("ul#list");
    
    var box_orig    = list.children('.box');
    var car_orig    = list.children('.car');
    
    ...
    $('#list li').each(
        function(){
            //alert($.inArray($(this).attr('class'),show) );
            if ($.inArray($(this).attr('class'),show) == 0)
            {
                if($(this).attr('class') == 'box')
                {
                    list.append(box_orig);
                }
                if($(this).attr('class') == 'car')
                {
                    list.append(car_orig);
                }
            }
            ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a combo box on a WinForms app in which an item may
We have a web app which can upload files to S3. For this to
I have div(box) on my page and I'm using this script to display div
I have a box like this: <div id=selectBox> Select: <select> <option>1</option> <option>2</option> </select> </div>
I am facing a problem storing original values of a form. I have a
I have select box for company whose values are populated from DB and I
I have a box where user activity will be inside. Now I am having
I have a case where user can select multiple values in the list box
Let's say we have box. In this box is another box (box2). I want
I have text box to enter a phone number. I'm using AJAX MaskedEditExtender and

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.