Questions tagged [wrapall]
A jQuery method that wraps an HTML structure around all elements in the set of matched elements.
79
questions
1
vote
4
answers
125
views
Moving multiple elements into new div
I want to move label, input and span elements inside the new div.
The structure is like this
<label for="" class="">First name</label>
<input id="fxb_8f3aee&...
0
votes
1
answer
147
views
Wrap every 2 differents elements inside specific div with wrapper class
I'am trying to wrap every two elements with my custom div.
Here is my code:
<div class="variation-radios">
<input type="radio" name="attribute_pa" value="60-cm">
<label for="60-...
0
votes
3
answers
346
views
How to wrap all children elements in a class?
I have a function that splits all lines in an element and wraps them in a <div>. For example, if I have an element that looks like:
<div class="test">
Lorem Khaled Ipsum is a major key ...
0
votes
1
answer
578
views
How to wrap a certain number of divs in another div?
What's the best way to wrap a certain number of divs into another div? For example if I have 19 divs, how do I use wrapAll to group 9 of them and still group them even if it's under 9.
This is what I ...
1
vote
1
answer
269
views
How to wrap multiple spans into a div
I have a JS code that wraps all lines into a span. I know I'm suppose to use wrapall but don't have any idea on where to start. Now I'm trying to find a way to wrap each of those spans into a div but ...
-2
votes
1
answer
41
views
wrap everything between hr elements
Trying to find a way to wrap all between hr tags in code, but nogo so far. Any advise on the code?
Here's what I'm doing right now (also as a fiddle):
$('hr').each(function() {
$(this).next('...
0
votes
1
answer
51
views
Scanning text in between two HTML elements and wrapping them with .wrapAll() function
I am working on a forum webpage but am not allowed to edit the HTML within the web page. I want to hide text until hovered over. This is a rough example of the HTML code:
<!doctype html>
<...
0
votes
1
answer
46
views
jquery: wrap n siblings and position them behind n elements
I'm destroying myself to get to a solution working in JQuery for the following prob: Inside a container I have a bunch of items and modals.
Depending on the screen solution I want to wrap the modals ...
2
votes
3
answers
2k
views
wrap all elements with div
I have been all over this site but have not found my answer. I am trying to wrap all divs into one wrapper. All I have been able to do so far using wrapAll is to add a container around each div. I don'...
0
votes
1
answer
294
views
Wrap every x elements into a div, then (after x wrap) wrap a different number of elements (for x wrap)
Is it possible to create this kind of loop?
For example : Wrap every 2 divs into a div, then (after 2 wrap) wrap every 3 divs (for 3 wrap)
<div id="container">
<div></div>
<div&...
0
votes
2
answers
498
views
jQuery "wrapAll" duplicate content
I have an issue with the wrapAll jQuery function.
I'm creating a Wordpress theme, and I need the menu elements to be slightly different on desktop than they are on mobile. Long story short, I need to ...
4
votes
1
answer
775
views
Split list of elements into groups
I would like to split list of elements into groups of 4 except one before last that should contain 2 elements only.
x x x x x x x
x x x x x x x
x x x x x x
x x x x x x
This ...
-1
votes
1
answer
67
views
How to wrap additional links with div?
I am trying to wrap links in a div if the there is more than 4 links in the parent div with jQuery:
<div class="acclinks">
<a href="#">1</a>
<a href="#">2</a>
...
4
votes
1
answer
864
views
WrapAll() on multiple classes with multiple appearance
Lets say this is my HTML
<ul class="products>
<li class="product">
<div class="product-title></div>
<div class="product-thumbnail></div>
<div class="...
-2
votes
2
answers
186
views
using jQuery to select elements until an element has a particular class, apply wrapALL to each set
My html is as below
<input class="beginFlex" name="name1" value="A">
<input name="name2" value="A">
<input class="endFlex" name="name3" value="A">
<input class="beginFlex" name="...
2
votes
4
answers
539
views
Jquery wrap set of elements with open and close tag
I have set of different elements, for example:
<section class="box-1"></section>
<section class="box-2"></section>
<section class="box-3"></section>
I would like ...
2
votes
2
answers
41
views
Confusing wrapAll in jQuery
I have several p inside several li as below and also as https://jsfiddle.net/y5zn538e/
<ul>
<li>
<p> Hello 1</p>
<p> Hello 2</p>
<p> ...
3
votes
4
answers
275
views
How to wrap all HTML-Code after <span class="xy"> until next occurence of </p>?
<p class="bodytext">
<span class="datum">19.11.2015:</span>Some text <a href="path/to/link" title="some title" class="download">Some text</a>. Again some text!
</p&...
0
votes
2
answers
237
views
jQuery Accordion Expand List of Daily Events
I'm trying to get the jQuery accordion to expand/collapse a list of daily events.
The entire event list is inside <div id="accordion"><!-- events here --></div>
Each day has an <...
0
votes
3
answers
1k
views
jquery :not(:first-child) wrapAll() each div
I want to select all elements except the first in a div with that class.
Current HTML:
<div class="cpt-cv-content-item">
<a>...</a>
<h4>...</h4>
...
</...
1
vote
1
answer
287
views
wrapAll and andSelf not wrapping self element
I'm using the code below:
$('.graph-img').each(function(index) {
$(this).prev('h2,h3,h4,h5,h6,p').prevUntil('.graph-img').andSelf().not('h1').wrapAll("<div class='prevent-break'>");
});
It'...
0
votes
2
answers
141
views
How to wrapAll an ELEMENT from title by jQuery?
Now I am playing with PageTranstionCollection
And I want to wrapAll an ELEMENT with title="wrap pt-page1". After that by Magic jQuery script it goes to
<div class='pt-page pt-page-2'>
&...
0
votes
2
answers
88
views
wrapAll matching elements in container within flexible layout
I have a flexible layout using Advanced Custom Fields for Wordpress. I want to wrap images with a class name of portrait in a containing div, I've done this with jQuery's wrapAll function, the problem ...
0
votes
1
answer
4k
views
How to wrap all next elements until?
I have following html:
<div class="menuItem">Domů</div>
<div class="menuItem">O nás</div>
<div class="menuItem">Výzkum a vývoj</div>
<div class="...
1
vote
2
answers
2k
views
How to wrap all elements that are next to each other and have the same class?
I would like to know how to wrap all elements that are next to each other and have the same class. .wrapAll() didn't work since it pushes the paragraph to the bottom.
Source:
<div class="...
1
vote
1
answer
43
views
JQuery, wrap div around every single div
I´ve got a small script, that should wrap a div "wrap_mod_article" around every single parent div "mod_article".
if ($("body").hasClass("test")) {
$('#content .mod_article').wrapAll('<div ...
0
votes
1
answer
415
views
JQuery wrapAll, append, remove to move elements and add a div
I am trying to move, and possibly remove some elements, along with wrapping the updated HTML with a 'div'. I have to use an equal count, that I have been able to calculate (let's assume I want to ...
0
votes
2
answers
900
views
.wrapAll() is not working properly in jQuery
I have this code:
<div id="archive-grid-view" class="row row-mobile">
<div class="list box text-shadow">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
...
6
votes
2
answers
1k
views
jQuery nextUntil include text nodes
I'm using nextUntil method to get all stuff between two elements. But this method does not include text nodes to output. It gives an array like [<br>, <br>, <br>]. How can I get all ...
0
votes
0
answers
160
views
Select list items by class and wrap
I'm looking for wrap a list items in this situation.
<ul class="subNav" style="top: 160px;">
<li class="level2 nav-3-1-1 first 3">3</li>
<li class="level2 nav-3-1-2 W"&...
0
votes
2
answers
54
views
How to wrap two dynamically created elements with span?
I need to create two elements <img> and <i> and wrap it with div element:
$('<img>', {
src: 'images/bank-507-logo.png',
id: "selected_" + selectedBank
})
$('<i>', {
...
0
votes
2
answers
223
views
How can I wrap the element with div container if it not wrap up with?
I tried to wrap the following element with div container, if it is not wrap up with.
<p class="fileDetails"><div class="filename">text goes here</div><div class="fileSize">...
2
votes
1
answer
1k
views
Wrap group of divs until next class
I have the following;
<div class="content">
<div class="row morepad">
<a href="#">Association 1</a>
</div>
<div class="row">
<a href="#">...
-2
votes
1
answer
1k
views
jQuery: Wrap elements with nextUntil()
<h2 id="match" class="contentHeadline">Match only in here</h2>
<p>I don't if or how many dl+table live here.</p>
<dl><dt>Text</dt></dl>
<table ...
2
votes
1
answer
327
views
jQuery wrapAll / unwrap messes up positioning
After wrapping divs with jQuery, unwrapping them and then trying to wrap them again seems to lose float property (my guess) and I can not figure out how to fix this.
When pushing wrap button in the ...
0
votes
2
answers
87
views
jQuery wrapAll category-1, category-2, etc
I'd like to be able to wrap multiple elements with the same class (for instance category-1) within a parent element. I know this can be done with jQuery wrapAll(). No problem there.
But what I want ...
0
votes
3
answers
150
views
jQuery .wrapAll() resets scroll of nested elements
Please take a look at the following fiddle:
http://jsfiddle.net/ardoramor/UzJqd/
When the fiddle loads, DIV with class .wrapper is scrolled 200px down. This includes all of the nested .wrapper. DIVs ...
1
vote
1
answer
329
views
How to wrap div around items?
My code wraps a div around every 5 child divs.
But the wrapping should only take place in the div "partnerwrap", can someone help me?
var divs = $(".partnerwrap > .partner_item");
for (var i =...
3
votes
1
answer
610
views
jQuery wrap multiple elements independent of level
This is my first post on stackoverflow. So far I could always find an answer here, but this time I couldn't.
Here is my DOM structure:
<div id="elementA">
<div id="elementB"></...
3
votes
4
answers
150
views
Warp multiple elements in random levels
I'm kinda stuck...
How can I wrap a collection of DOM elements on different levels in a combined div?
Here an example:
<div id="item1">
<div id="item2"></div>
<div id="...
0
votes
1
answer
746
views
jQuery wrapAll() is not working with ul class
I have a small script code with a wrapAll() function that works with a div id when I target the div ID but if I try to target a ul class, it is not working:
<script>
$("#block-tb-...
1
vote
1
answer
3k
views
Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist
Can't really descripe why this is not working.
I do have JS-Object controlling some data and each controlls also an HTML-Object.
That objects are stored in an Array. I do that a couple of times in ...
0
votes
1
answer
880
views
jQuery wrapAll wraps content twice
I am working with Drupal views where I have to wrap the table with div tag with class. I did something like this in jQuery:
jQuery('table.views-table.table').wrapAll("<div class='table-responsive'&...
4
votes
2
answers
1k
views
How can I wrap each element and all its siblings before the next occurrence of the same element?
I've got some markup that's similar to the following:
<h3>A Heading</h3>
<p>Here is a paragraph.</p>
<ul>
<li>First</li>
<li>Second</...
0
votes
1
answer
2k
views
jQuery add element into wrap after wrapall
I'm trying to wrap a hand full of elements and add an extra div into the wrap.
I've tried -
$('.product-addon-one-attendee').wrapAll("<div class='single-attendee-wrapper'></div>")....
0
votes
4
answers
2k
views
Jquery finding set of element by attribute and wrapping them in a new div
I have a bunch of <ul>s that have the attribute data-year. I want to wrap the data-year attributes with the same value in a div like so: <div class="year"><div>
before:
<div ...
0
votes
1
answer
508
views
.wrapAll except one inside a general wrapper
I have a group of generated divs width the same class which containts a header and a series of links. And for some reason a hidden header at the end.
They look something like this:
<div class=...
-1
votes
1
answer
313
views
How to wrap and re-order elements inside?
I am trying to wrap some elements with jQuery in a li element. My problem is that I want to switch the order they will be inside the li. Right now is li start - a - div - li end, but I want li start - ...
2
votes
3
answers
67
views
Wrap several div with other div
I have several div as following:
<div id='id1'>blabla</div>
<div id='id2'>blabla</div>
<div id='id3'>blabla</div>
<div id='id4'>blabla</div>
<div id=...
3
votes
1
answer
987
views
How to wrap h1 and follow content in div? [duplicate]
I need to know how to wrap h1 and follow content in div. This is the original structure:
<h1>Title #1</h1>
<p>Text</p>
<p>Text</p>
<h1>Title #2</...