# Template error - expecting ; javascript

**URL:** <https://forum.djangoproject.com/t/template-error-expecting-javascript/40324>\
**Category:** Mystery Errors\
**Created:** [April 9, 2025, 11:44am UTC](https://forum.djangoproject.com/t/template-error-expecting-javascript/40324 "2025-04-09T11:44:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlc1978](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jlc1978/32/23432_2.png) [@jlc1978](https://forum.djangoproject.com/u/jlc1978)\
**Post date:** [April 9, 2025, 11:44am UTC](https://forum.djangoproject.com/t/template-error-expecting-javascript/40324/1 "2025-04-09T11:44:45Z")

</div>

I am getting an error in all of my templates for all the paths in buttons. This error appeared after I switched computers and opened the project in VS Code. The odd thing is it runs just fine, no errors in the browser but every template with a button that specifies a url yields the error.

```auto
{% extends "ESG/layout.html" %}

{% block content %}
<style>
</style>
{% csrf_token %}

<div class=t4>

<!-- Use text in Introduction in DB for text in HTML Page-->
{{ intro_text|safe}}
</div>
<button input type='button' name=Begin Survey onclick="location.href='{% url 'results' pathstr=current_path %}'"><lable>Begin Survey</lable></button>
{% endblock %}

```

Error details:

```auto
[{
	"resource": "/Volumes/Backup/Current Python Projects/Python Projects/Strategia/ESG/templates/ESG/introduction.html",
	"owner": "_generated_diagnostic_collection_name_#1",
	"severity": 8,
	"message": "';' expected.",
	"source": "javascript",
	"startLineNumber": 13,
	"startColumn": 79,
	"endLineNumber": 13,
	"endColumn": 86
}]

```

It doesn’t seem to matter if the template extends another or not, but here is the template that is extended:

```auto
{% load static %}

<!DOCTYPE html>
<html lang = "en">
<meta name="viewport" content="width=device-width, initial-scale=1, height=device-height">
<head>
    <link rel="stylesheet" href="{% static 'css/styles.css' %}">
    <script src="{% static 'js/echarts.js' %}"></script>
    <title>{{ browsertab }}</title>
</head>
<body>
    <h1>{{ dashboard_title }}</h1>
    
<!--Create flexbox to render header graphic--> 
    <div class="container_layout" style="top: 5%;">
<!--Create LOO shape-->    
        <div class="item_LoO_Name">
          <div class="t1">{{ project }}</div>
          <div class="t2">{{ projecttext }}</div>
        </div>
<!--Create row of topic shapes and spacer between shapes-->
        {%for x_topics in surveytopics%}
        <div class="space"></div>
        <div class={{x_topics.context}}>{{ x_topics.area }}</div> 
      {% endfor %}  
<!--Create pointed arrow and space to Outcome-->
      <div class="space"></div>
      <div class="triangle-right"></div>
      <div class="spaceblank"></div>        
<!--Create Outcome Shape-->
      <div class="item_Outcome_Name">
        <div class="t1">{{outcome}}</div>
        <div class="t3">{{ outcometext }}</div>
      </div>
    </div> 
    <br>  
    {% block content %}
    {% endblock %}
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [April 9, 2025, 12:02pm UTC](https://forum.djangoproject.com/t/template-error-expecting-javascript/40324/2 "2025-04-09T12:02:34Z")

</div>

Where exactly are you seeing this error? Is this in your browser? Some other script?

This isn’t any Django error I’m familiar with.

> [@jlc1978](#):
>
> ```auto
> "startLineNumber": 13,
> "startColumn": 79,
> "endLineNumber": 13,
> "endColumn": 86
> 
> ```

Line 13 of the template you’ve posted is:  
`<button input type='button' name=Begin Survey onclick="location.href='{% url 'results' pathstr=current_path %}'"><lable>Begin Survey</lable></button>`

My guess is that this is a false reporting of an error, in that whatever tool you’re using that is showing you an error doesn’t understand Django template language and doesn’t know that what’s between the `{% %}` markers represent text that will be substituted by the rendering engine.

---

<div class="post-metadata">

**Author:** ![jlc1978](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jlc1978/32/23432_2.png) [@jlc1978](https://forum.djangoproject.com/u/jlc1978)\
**Post date:** [April 9, 2025, 12:07pm UTC](https://forum.djangoproject.com/t/template-error-expecting-javascript/40324/3 "2025-04-09T12:07:03Z")

</div>

Thanks. It shows up in VS, the IDE I use, in the PROBLEMS section of the terminal view. I just found it odd when I moved the project to a new computer all of a sudden this error appeared.

Given everything works, I suspect VS Code is incorrectly reporting it as a javascript error.

---

<div class="post-metadata">

**Author:** ![ChathuraGH](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/chathuragh/32/27563_2.png) [@ChathuraGH](https://forum.djangoproject.com/u/ChathuraGH)\
**Post date:** [April 9, 2025, 1:13pm UTC](https://forum.djangoproject.com/t/template-error-expecting-javascript/40324/4 "2025-04-09T13:13:06Z")

</div>

> [@jlc1978](#):
>
> Given everything works, I suspect VS Code is incorrectly reporting it as a javascript error.

Yes. VS code is using js error checking in html/django files, that’s why. Of course it would show errors. Because django template tags are not js. It will show up as errors.

![Screenshot (15033).png4](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/4/c/4c192b8a4a330aeaa44f13eefe64131566888a1f.png)

See, in sublime we can change syntax/type.

Just click on HTML(django) text.
