Inject HTML into class with jQuery

Recently, restricted by a managed platform I needed to inject html into a class with jQuery to deliver the desired result. Below is a sample of the code I wrote to achieve this in case you find yourself needing to inject some HTML at the start of a class rather than use and id.



The prepend() method inserts the specified content as the first child of each element in the jQuery collection.

Find more code snippets.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.