Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
¿Cómo renderizar el descuento en html?

Estoy usando js marcados para representar una cadena que contiene texto de descuento en html div.
índice.html

 ... <div id="myDiv"></div> <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> <script src="index.js"></script> ...

índice.js

 ... function renderMarkdown() { let myDiv = document.querySelector('#myDiv'); myDiv.innerHTML = marked.parse('# This is heading \n ## This is heading 2 \n ### This is heading 3 \n Let us write a quick text and sign off! Here is a list \n - Hello \n - World') } async function getMarkdownFile() { const response = await fetch('./content/hello.md', { method: 'GET', }) .then(response => response.text()) .then(data => { console.log(data); }) } ...

El descuento se representa dentro de myDiv como se esperaba.
ingrese la descripción de la imagen aquí

También tengo una carpeta en el mismo directorio que contiene un montón de archivos de descuento. Pero no puedo importarlos/usarlos en el archivo index.js . Intenté usar fetch pero obtuve este error:

ingrese la descripción de la imagen aquí

Como es evidente, se vuelve muy difícil editar y leer cadenas más grandes. ¿Hay alguna forma mejor de representar el descuento en el html (tal vez importando un archivo de descuento)?
PD: Estoy usando Vanilla Js.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!