DreamWeaver Auto comment after tag closing

Using Dreamweaver, is there any way to automate the launch of a class or ID as a comment immediately after the tag is closed? For example, this is the original code

<section class="container">
   <div id="menu">

   </div>
</section>

      

Is it possible to convert it as

<section class="container">
   <div class="row">

   </div><!-- end .row -->
</section><!-- end .container -->

      

Thanks in advance.

+3


source to share


1 answer


I found the answer here

and I think it should work:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">

/* Comment Division End Tags script ©2008 John Davenport Scheuer
   as first seen in http://www.dynamicdrive.com/forums/
   username:jscheuer1 - This notice must remain for legal use
*/

function commentEndTags(){
for (var c, d = document.getElementsByTagName('div'), i = d.length - 1; i > -1; --i)
if(d[i].id || d[i].className){
c = document.createComment(' end div' + (d[i].id? ' id:' + d[i].id : '') + (d[i].className? ' class:' + d[i].className : '') + ' ');
if(d[i].nextSibling)
d[i].parentNode.insertBefore(c, d[i].nextSibling);
else
d[i].parentNode.appendChild(c);
}
var commented = document.createElement('textarea');
with (commented){
rows = 20;
cols = 80;
wrap = 'off';
with (style){
position = 'absolute';
zIndex = 10000;
top = '0px';
left = '0px';
overflow = 'auto';
}
}
commented.value = document.body.innerHTML;
document.body.appendChild(commented);
}
if(window.addEventListener)
window.addEventListener('load', commentEndTags, false);
else if(window.attachEvent)
window.attachEvent('onload', commentEndTags);
</script>
</head>
<body>
<div id="rwf_OuterContainer">
    <div id="rwf_MainContainer">
    </div>
</div>
<div id="bob" class="otherContainer">

</div>
</body>
</html>

      



Please note that this will not work in DW Runtime, it will only work on the rendered page.

but from personal experience I would recommend the Emmet plugin.

Here's an example on how to use it to automatically comment after a tag is closed.

+2


source







All Articles