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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:59:00+00:00 2026-05-25T23:59:00+00:00

For example I have this code… <div id=outerdiv> <!–other tags–> <div class=innerdiv> <!–other tags–>

  • 0

For example I have this code…

<div id="outerdiv">
    <!--other tags-->
    <div class="innerdiv">
        <!--other tags-->
        <fieldset>
            <!--other tags-->
            <!--one start-->
            <fieldset>
            <!--other tags-->
            </fieldset>
            <fieldset class="myclass">
            <!--other tags-->
            </fieldset>
            <!--one end-->
        </fieldset>

        <!--two start-->
        <fieldset>
        <!--other tags-->
        </fieldset>
        <fieldset class="myclass">
        <!--other tags-->
        </fieldset>
        <!--two end-->

        <!--two start-->
        <fieldset>
        <!--other tags-->
        </fieldset>
        <fieldset class="myclass">
        <!--other tags-->
        </fieldset>
        <!--two end-->

        <fieldset>
            <!--other tags-->
            <!--one start-->
            <fieldset>
            <!--other tags-->
            </fieldset>
            <fieldset class="myclass">
            <!--other tags-->
            </fieldset>
            <!--one end-->
        </fieldset>
    </div>
    <div class="innerdiv">
        <!--other tags-->
        <!--two start-->
        <fieldset>
        <!--other tags-->
        </fieldset>
        <fieldset class="myclass">
        <!--other tags-->
        </fieldset>
        <!--two end-->

        <fieldset>
            <!--other tags-->
            <!--one start-->
            <fieldset>
            <!--other tags-->
            </fieldset>
            <fieldset class="myclass">
            <!--other tags-->
            </fieldset>
            <!--one end-->
        </fieldset>

    </div>
</div>

As you can see one and two are exactly the same, however I want two to be encapsulated also by a fieldset. I can do this with jquery right?..but how?

Update

Updated code because there isn’t only two of them..hehe and there other tags

  • 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-25T23:59:01+00:00Added an answer on May 25, 2026 at 11:59 pm

    As you want to wrap two elements with one structure, you’re going to need to use .wrapAll. You can’t use .wrap because that wraps the HTML around each matched element, not around all of the matched elements. The first thing that came to my mind was this:

    $("#firstFieldset").next().andSelf().wrapAll("<fieldset>");
    

    Given the HTML:

    <fieldset id="firstFieldset"></fieldset>
    <fieldset class="myclass"></fieldset>
    

    Here’s a working example (inspect the source of the output window). What it does is select the first fieldset, get the following sibling, add the original one back into the matched set of elements and wrap the entire matched set in a fieldset.

    Update based on comments

    var yourFieldset = $("#mydiv > fieldset:first").next();
    yourFieldset.next().andSelf().wrapAll("<fieldset>");
    

    The first line gets the first fieldset which is a direct child of #mydiv, then gets the next sibling which is the first fieldset of your second set.

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

Sidebar

Related Questions

For example I have this HTML code: <div id=canvas> <div id=root> <div id=content> <span>
Suppose I have this code: class Example(object): def the_example(self): itsProblem = "problem" theExample =
I have this code for example public class BaseClass {} public class DerivedClass1 :
I have this (example) code: init() class A: foo = bar() def __init__(self): print(A.foo)
So for example I have this code: class Object{ public $tedi; public $bear; ...some
i have this example: class One { public void testOne(){System.out.println(One!!!);} public void testTwo(){System.out.println(One!!!);} }
I have this code : function showContent() { ... } <div id=example> content <a
I have this code, but it is not a practical example. Ex. class Animal
For example I have this code: <%= link_to Start, start_path(:id=>1,:box=>1)%> the id and the
For example I have this snippet of html code: ..... <span class=no> 1</span> require

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.