jQuery plugin: Shift Heading Levels
Shifts heading levels up or down.
Use
<script src="jquery.min.js"></script>
<script src="jquery-shift-heading-levels.min.js"></script>
$( selector ).shiftHeadingLevels( shift_amt );
shift_amt
can be positive or negative, and defaults to 1. Heading levels will not be shifted below 1 or above 6.
If something other than a heading is selected, the headings it contains will be shifted.
Attributes and contents are maintained.
Examples
$( 'h1' ).shiftHeadingLevels();
$( 'h2' ).shiftHeadingLevels( 2 );
$( 'h3' ).shiftHeadingLevels( -1 );
$( 'h4' ).shiftHeadingLevels( 100 );
$( '#this-is-an-h5' ).shiftHeadingLevels();
$( '#this-is-a-div' ).shiftHeadingLevels();