Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commented out HTML visible in Inspect Elements, Why?

Tags:

html

magento

I have commented out a line in HTML in Magento store however when I go to Chrome and click on Inspect Elements, I still see the code but its commented out.

What can I do to prevent the HTML code i have commented out to make it invisible from Inspect Elements ?

I don't want to delete the commented out section in case I will need it later on.

Any solutions ?

like image 452
philtak Avatar asked Dec 11 '25 00:12

philtak


1 Answers

HTML comments are part of an HTML document. They are not rendered for display by the browser, but they are part of the document sent from the server to the client machine. Thus HTML comments are visible when inspecting element or when viewing the source.

I believe Magento store is written in PHP and you could comment out the line in the php file like this

<?php
/*
line to comment out
*/
?>

The HTML document the PHP sends back to the browser will not contain that comment.

like image 77
Joel Anderson Avatar answered Dec 12 '25 15:12

Joel Anderson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!