jquery-empty-or-whitespace

1.0.0 • Public • Published

jquery-plugin-empty-or-whitespace

Add a CSS class to elements that are empty or contain only whitespace.

Usage

Add jquery.empty-or-whitespace.js to you page after jquery. Then select elements you want to detect and call the plugin:

<div>
</div>
<div><div></div></div>
<script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="jquery.empty-or-whitespace.js"></script>
<script>
  $("div").emptyOrWhitespace()
</script> 

Output:

<div class="empty-or-whitespace">
</div>
<div><div class="empty-or-whitespace"></div></div>

You can specify the CSS class name by passing it as the first parameter to the plugin function call e.g.

$("div").emptyOrWhitespace("empty")

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0

Package Sidebar

Install

npm i jquery-empty-or-whitespace

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • alanshaw