Assuming you know how to get to your elements, enabling is a one liner:
$(element).attr("href", $(element).data("href"));
since the data-href
does nothing, you don't need to remove it. Just mirror it as real href
attribute. To invalidate, either invalidate the href
attribute again:
$(element).attr("href", false);
or remove it altogether:
$(element).removeAttr("href");
And for <img>
it's the same trick but with the string "src"
instead of "href"