Edit HTML Comment Text using JQuery or Javascript -


is possible edit text enclosed inside html comment using javascript or jquery. example if have comment like:

<!-- comment -->  

then possible change text 'this comment' using jquery or javascript?

thanks.

you can iterate through childnodes of comment's parent element, filter commentnode , change it's value resetting nodevalue property:

$('#parent').contents().each(function() {     if ( this.nodetype === 8 ) {        this.nodevalue = 'changed value';     } }); 

using vanilla javascript:

var parentnode = document.getelementbyid('parent');  [].foreach.call(parentnode.childnodes, function(el) {     if ( el.nodetype === 8 ) {        el.nodevalue = 'changed value';     } }); 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -