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

127
Vistas
Jquery reemplazando la URL de la imagen con el elemento html

entonces tengo este codigo

 let data.message = "message https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png" $('<div/>').text(data.message).html().replace(/((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g, '<img src="$1">$1</a> ')

No sé por qué no funciona, divide la línea en mi cosa porque es una aplicación de chat, pero divide el http s: // por alguna razón, aquí está el código para ir a la siguiente línea:

 function getName(name) { let newName = name; // offsets i to match the current string let offset = 0; for (let i = 1; i < name.length; i += 1) { if (i % 35 === 0) { if(newName.charAt(i) === ' ') { // Your own code with the offset newName = newName = `${newName.substr(0, i - offset)}\n${newName.substr(i - offset + 1)}`; } else { // looking back in the string until there is a space or the string "ends" while(newName.charAt(i - offset) !== ' ' && offset <= 35) { offset++; } // Only set newName if a space was found in the last 35 if(i - offset > 0) { newName = `${newName.substr(0, i - offset)}\n${newName.substr(i - offset + 1)}`; } } } } return newName; }
about 4 years ago · Juan Pablo Isaza
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