2 Replies - 172 Views - Last Post: 13 July 2011 - 01:07 AM

#1 been_1990  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 66
  • Joined: 20-February 10

html comments and their retrieval

Posted 12 July 2011 - 07:16 PM

How can I read html comments with JS?
Is This A Good Question/Topic? 0
  • +

Replies To: html comments and their retrieval

#2 arvindthakur  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 133
  • Joined: 07-June 11

Re: html comments and their retrieval

Posted 12 July 2011 - 10:22 PM

Do you want to comment html or javascript code lines?

If your answer is yes then

For HTML------
1.use <!-- before the start of tag and put --> after the end of tag line which you want to comment.Do the same for multiple lines comment.

For javascript---
1. Use // before start of line you want to comment - for single line comment.
2. Use /* before start of first line and put */ after the end of last line for multi-line comments in js.
Was This Post Helpful? -1
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3569
  • View blog
  • Posts: 10,402
  • Joined: 08-June 10

Re: html comments and their retrieval

Posted 13 July 2011 - 01:07 AM

you would have to go through the nodes and test, whether the nodeType of the node matches a comment (i.e. elem.nodeType == Node.COMMENT_NODE)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1