toggleAttr has altered the attribute of the jQuery DOM element. toggleAttr.js is a very small jQuery extension that makes it possible to swap single or multiple attributes from a given DOM in a single JS call.
toggle attribute jquery, toggle attribute hidden, jquery toggle hidden attribute, jquery toggle data attribute, toggle javascript, jquery toggle attribute true false
Example usage:
- $(“.example”).toggleAttr(‘attributeName’);
- $(“.example”).toggleAttr(‘attributeName=”exampleValue”‘);
- $(“.example”).toggleAttr(‘attributeName attr2=”value” attr3’);
How to make use of it:
1. Load the jQuery-toggleAttr.js
JavaScript library after jQuery.
<script src="/path/to/cdn/jquery.slim.min.js"></script> <script src="/path/to/jQuery-toggleAttr.js"></script>
2. Remove the href
attribute from a link.
<a href="https://www.google.com" id="linkExample"> Example Link </a>
$("#linkExample").toggleAttr("href");
<!-- Result: --> <a id="linkExample"> Example Link </a>
Toggle Attribute From Element, toggleAttr Plugin/Github, toggle attr jquery, toggle attribute in jquery, jquery toggle attribute value, toggle property jquery
See Demo And Download
Official Website(gokhanege): Click Here
This superior jQuery/javascript plugin is developed by gokhanege. For extra Advanced Usage, please go to the official website.