Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

289
Vistas
FLASK Unable to change CSS with JS file

Trying to change the background with my URL input using jinja2/flask alongside python/javascript.

The alert works. Background color doesn't however. Works on a file that only has html/js/py.

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
    <script type="text/javascript" src="{{ url_for('static', filename='script.js') }}"></script>
    <title>♟️Checkerboard</title>
</head>
<body>
    <div class = "container">
        {{output}}
    </div>
</body>
</html>

Python

from flask import Flask, render_template, request, redirect
app = Flask(__name__)

@app.route('/')
def hello(): 
    output = "hello world"
    return render_template('index.html', output = output)

if __name__=="__main__":  
    app.run(debug=True)      

JAVASCRIPT

alert("Testing");
document.body.style.backgroundColor = "red";

Basically all file links have proven to work. document.body.style.backgroundColor = "red"; proven to work. document.body.style.backgroundColor = "red"; doesn't work in jinja/flask.

Please help.

about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda