Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LICENSE Add MIT LICENSE file Apr 12, 2018 Add MIT LICENSE file Apr 12, 2018
jquery.nwrapper.js ver1 Jun 27, 2011
nwrapper.jquery.json jquery manifest added Jun 26, 2013

nwrapper jQuery plug in

jQuery provides a large variety of funtions for element manipulation, that in most cases will manipulate the selected elements in no time. A very useful function for every day manipulation is the .wrap() function that we can use to wrap an HTML structure around each jQuery element. But what happens when we want to wrap an HTML structure every n’th number of the selected elements? Unfortunately, jQuery doesn’t provide any options to the warp function in order to to do something similar.

Well with nwrapper you can do just that.

How to install/use

First of all the plugin (after you load jQuery) just like this :

`<script type="text/javascript" src="../js/jquery.min.js"></script>

<script type="text/javascript" src="../js/jquery.nwrapper.js"></script>`

To use it, just select the parent element of the elements you want to wrap, choose how often you’ll apply the wrap (wrapEvery attribute – default is 1), choose if you need the default classes or even provide your own extra classes (extraClasses as an array), and finally provide the HTML structured element you’ll use for a wrapper (the default is div, but you can also use a span or any other element).

$('#container').nwrapper({ wrapEvery : 2, defaultClasses : true, extraClasses : ['class1', 'class2'], htmlStructure : 'span' });

Demo / Contact

Have a look at the demo page. For questions or requests don't hesitate to drop me line here (Github) or on my blog.