Javascript closing tag is echoed twice from php

<?php
     echo "<script type = 'text/javascript'></script>";
?>

output’s page source shows this :

<script type = 'text/javascript'></script></script>

Why is it putting an extra closing tag ?? and who is putting it there ?? browser ? server ? who ?

Answer

Perhaps it’s your browser’s DOM parser that is putting the ending tag in. Have you checked the code above it to see if you have any unterminated <script> tags?

Leave a Reply

Your email address will not be published. Required fields are marked *