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

187
Vistas
js - marking bracket pair in input text box depending on cursor position

I'm working on a math project. Therefore I want to modify the 'input text'-Box. It should mark the bracket pair of the cursor i. e. the bracket positioned left and the one right from the cursor.

I already know, how to get the cursor position:

document.getElementById('inutField').addEventListener('keyup', e => {
  console.log('pos: + e.target.selectionStart)
})

Now I thought about formatting a string

str = '3*<span>(</span>4+5<span>)</span>*6

formatting the span tag (maybe bold) and put it into the Text field with

document.getElementById('inputField').value = str;

Unfortunately the value variable doesn't take formatted strings, so it won't work.

Mayby someone has an idea or there is a library that already solves the problem?

Thanx for your help...

Philipp

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It seems like an overkill but you could use one of the WYSIWYG editor libs. The most popular are:

  • https://quilljs.com/
  • https://ckeditor.com/
about 4 years ago · Juan Pablo Isaza Denunciar
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