jQuery Methods: before()

By: Dusty Arlia
Published on Tuesday, October 21, 2014 at 8:34 PM
Last Updated on Saturday, July 11, 2015 at 9:03 PM
Total Updates: 2

The jQuery before() method is used to add content before each element in the set of matched elements. The content is passed as an argument to before(). Content can be a string literal of some HTML text or it could be a jQuery selector: $( "h2" ). If the content argument is a jQuery selector, then the selector will actually move the selected element from its current location, to before the jQuery object that this method is called on (the selected content is NOT cloned).