Html tables with some commented tags. i just wanted to uncomment those tags. I have tried regex using javascript but problem is it removes entire commented line where as i
There's a very useful little jquery plugin that does precisely this. I didn't write it, but it's open source and here's the code & attribution to original source:
http://vistaprint.github.io/SkinnyJS/jquery.uncomment.html
Works well on our site.
Javascript is:
(function ($) {
$.fn.uncomment = function () {
for (var i = 0, l = this.length; i < l; i++) {
for (var j = 0, len = this[i].childNodes.length; j < len; j++) {
if (this[i].childNodes[j].nodeType === 8) {
var content = this[i].childNodes[j].nodeValue;
$(this[i].childNodes[j]).replaceWith(content);
}
}
}
};
})(jQuery);
Just put your code into
and call it with
$(".commented-container").uncomment();
We're using it to defer/exclude some image-heavy galleries for mobile users, to speed the page loads.
Part of skinny.js.. which you can find here: http://vistaprint.github.io/SkinnyJS/