Search code examples
javascriptphpjquerycustomizationexternal

how to add(link) my customized javascript code to any html/php page


i would like to add javascript to an html page. I don't want to have those scripts inline on the home page however, I would like them to be in an external javascript file. How do I link to an external javascript file so those scripts are run on the page?

<html>
<head> <title>asc Computer Grass Roots pvt. ltd.</title>
        <script src="jquery.js"></script> 
        <script>    my jquesry scrips here
        </script>
</head> 
<body>  somecodes </body> 
</html>

Solution

  • Instead of

    <script>my jquesry scrips here</script>
    

    put

    <script src="myscript.js"></script>
    

    Of course you will have to create a file named 'myscript.js' and type javascript code in it.