I'm working on a site. It contains a lot of comments. When a user click the view page source
in any browser, I want to hide or remove the comments from the HTML.
Is this possible? If possible, could someone say a way to achieve it.
To create hidden comments in HTML, we add <! --- tag and end it with -- >. Whatever comes inside this tag it is hidden. These comments allow us to easily understand the code.
Note: Comments are not displayed by the browser, but they can help document your HTML source code.
Comment is a piece of code which is ignored by any web browser.
At the moment I decided to use php to create html and jquery comments to hide them in view source
like
<input type="submit" value="Submit">
<?php //this is comment regarding input ?>
Possibly it affects performance... but found no other way
Regarding jquery one note.
//$('#upper_level_id0').css('color', 'red');<?php //works ?>
$('#upper_level_id'+index).remove();
In this example $('#upper_level_id'+index).remove();
does not work.
$('#upper_level_id0').css('color', 'red');<?php //works ?>
//$('#upper_level_id0').css('color', 'red');
<?php //works ?>
$('#upper_level_id'+index).remove();
But in this example all works. So conclusion that <?php
comment better tos start in new line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With