I am currently working on a flask project and was trying to test something.
I got the following basic code:
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test</title>
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}">
</head>
<body>
<nav>
<ul>
<li><a href="{{ url_for('index') }}">Startseite</a></li>
<li><a href="{{ url_for('page2') }}">Page2</a></li>
</ul>
</nav>
<div class="container">
<h1>Hello World</h1>
<p>Hello World</p>
<button onclick="window.location.href='{{ url_for('page2') }}'">Hello World</button>
</div>
</body>
</html>
The url for in the stylesheet and in the navbar works fine.
The button seems to be also working (maybe cookies, will test that) but VS Code shows me the following Error: ‘;’ expected href
Error
I know there are articels with the following solution: <a href="{{ url_for('account.signin') }}?next={{ request.path }}">Sign in</a>.
But for the href in the li-tags it is working without a problem, its just the one in the button
Am I doing something wrong so there is a way to fix that? Because in the file manager the file is red because of the error, which is pretty annoying… If the code is correct/fine is there a way to tell VS Code to just ignore this error?
Thank you in advance
I mean according to google it should work.
If I just use a static file it is also working..
using a static route is working, and also no fault on the url for in the
user is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.