Question: I'm woking on a ASP.NET project and im trying to use the attr function,
when im putting in the script tag the src for the jquery file the function isnt being called when im calling it via c# code.

```
 <script type ="text/javascript" src="jquery-3.1.1.min.js">
    $(document).ready(function () {
        function startGame(path) {
            alert(path);
            $("#test").attr("style", "color:Blue");
            $("#game_param").attr("value", path);
            $("#game_embed").attr("src", path);
        }
    });   
</script>

```

I tried to write a simple javascript fucntion

```
<script type ="text/javascript" src="jquery-3.1.1.min.js">
    function startGame(a) {
        alert(a);
    }
</script>

```

and it wasn't called either

im getting en error that startGame isn't defined, in both cases.
can someone expain to me what im doing wrong?

Answer: 
You need to include the jQuery source separately from your custom code. Otherwise I believe what is inside of the script tag is ignored.

```
 <script type ="text/javascript" src="jquery-3.1.1.min.js"></script>
 <script type="text/javascript">
  $(document).ready(function () {
    var p = 'here/is/my/path';
    function startGame(path) {
        alert(path);
        $("#test").attr("style", "color:Blue");
        $("#game_param").attr("value", path);
        $("#game_embed").attr("src", path);
    }
    startGame(p);
 });
 </script>

```
Your Javascript isn't correct.

When you do:

```
<script type ="text/javascript" src="jquery-3.1.1.min.js">
  function startGame(a) {
    alert(a);
  }
</script>

```

You're setting the source of the JavaScript file to be the jQuery JS file. If you want to define your own functions, you have to put it in its own `script` tag, like so:

```
<script type ="text/javascript" src="jquery-3.1.1.min.js"></script>
<script type="text/javascript">
    function startGame(a) {
        alert(a);
    }
</script>

```