Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment within an HTML attribute?

Tags:

comments

html

The final (closing) angle bracket in the code below is not interpreted as closing the <input> element:

<input type='text' name='name' <!-- id='name' -->>

I thought this was a valid way to comment out this attribute but Google Chrome, Firefox and Notepad++ (color coding) all suggest that this is not the way to go.

I used CTRL+Shift+Q in Notepad++ to do this.

Then what is the proper way to comment out this <id> attribute?

like image 736
RubenGeert Avatar asked Dec 24 '12 11:12

RubenGeert


Video Answer


1 Answers

I usually just put _x at the end of the attribute name. Then the attribute is ignored because it's unknown. So if I wanted to comment out the id attribute from this element:

<input type="text" name="name" id="name">

I would change it to this:

<input type="text" name="name" id_x="name">

This also has the advantage of being able to search for "_x=" to find all commented attributes.

like image 121
intrepidis Avatar answered Nov 15 '22 22:11

intrepidis