1.0.2 • Published 8 years ago

append-content v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

appendContent.js

A jQuery plugin that appends some content an element and adds a class. If the element already has the class, it does nothing. Could be useful in situations where it's not feasible to edit the markup, or you've added some generated content using a pseudo element and need it to actually be in the DOM for screen readers.

How to use

npm install --save append-content
$('.required').appendContent({
  className: 'required--injected',
  content: '<span class="injected-text">(required)</span>',
});

Options

It accepts an object with options.

OptionDescriptionRequired?
classNameClass name to apply once the content is appendedRequired
contentThe content to appendRequired