Attr with jQuery
html
jQuery
<div id="elemAttr" yolo="nop">Element with attribute</div>
<button onclick="addAttribut()">Add attribute</button>
<button onclick="removeAttribut()">Remove attribute</button>
<script>
function addAttribut() {
$("#elemAttr").attr("yolo", "yep")
};
function removeAttribut() {
$("#elemAttr").removeAttr("yolo");
};
</script>
Element with attribute