1

Sample structure:

<div>1111111111</div> <!-- First line -->
<div>2222222222</div> <!-- Second line -->
<div>3333333333</div> <!-- Third line -->

It's OK. However, I want to wrap comment for this divs.

Sure, not working like this:

<!--
    <div>1111111111</div> <!-- First line -->
    <div>2222222222</div> <!-- Second line -->
    <div>3333333333</div> <!-- Third line -->
-->

How can I do this?

Mary Jane
  • 57
  • 4
  • 2
    You can't have nested comments. You can remove the closing `-->` from one of the inner comments to make this work, though – Bojangles Feb 11 '14 at 10:10
  • possible duplicate of [HTML comments within comments?](http://stackoverflow.com/questions/3773719/html-comments-within-comments) – Kristof Feys Feb 11 '14 at 10:12
  • I know and thanks but it's not valid solution. I have very complex HTML file and not possible remove `-->` tags. – Mary Jane Feb 11 '14 at 10:12
  • You might find it useful http://stackoverflow.com/questions/442786/are-nested-html-comments-possible – eu.vl Feb 11 '14 at 10:14

1 Answers1

2

If you really can't change any comments within the original source, but you can (or so it seems) wrap some lines in the source with something. You could turn the lines into a JavaScript multi line comment like I have done in this jsFiddle.

<script type="text/javascript">
    /*
<div>1111111111</div> <!-- First line -->
<div>2222222222</div> <!-- Second line -->
<div>3333333333</div> <!-- Third line -->
    */
</script>
Mathijs Flietstra
  • 12,900
  • 3
  • 38
  • 67