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

153
Vistas
trying to send textarea.value to discord embed not working

My HTML and JS script are here. The message that you get from the first textarea works but not from the text that is actually in the Modal. I am trying to use the text that is typed into the textarea by using .value, is this right? Yes, this is in a html thing and all that stuff, it is unnecessary to include that though.

<label for="contentWebhook1">Type here what you would like to send as the message (not in modal)</label>
    <br>
    <textarea id="contentElement" name="contentWebhook1" rows="4" cols="50"></textarea> // this works fine
    <br>
    <label for="titleContent2"> This is the title of the modal</label>
    <br>
    <textarea id="contentTitle" name="titleContent2" rows="4" cols="50"></textarea>
    <br>
    <label for="contentDescription">Description</label>
    <br>

    <textarea name="contentDescription" id="contentDescriptionWebhook" cols="50" rows="3"></textarea>
    <button onclick="sendMessage()">Send message </button>
    <script>

        const messageContent = document.getElementById('contentElement');
        const messageTitle = document.getElementById('contentTitle');
        const descriptionTitle = document.getElementById('contentDescriptionWebhook');

            function sendMessage() {

            const request = new XMLHttpRequest;
             request.open("POST", "my link here, does work");
             request.setRequestHeader('Content-type', 'application/json');

              const params = {
                username: "",
                avatar_url: "",
                content: messageContent.value,
                embeds: [ myEmbed ]
             }

              request.send(JSON.stringify(params));
          }

          function hexToDecimal(hex) {
            return parseInt(hex.replace("#", ""), 16)
           }
        
            var myEmbed= {
                author: {
                name: ""
            },

            title: messageTitle.value,
            description:descriptionTitle.value, // This goes inside modal under title ^
            color: hexToDecimal("#2e5883") // This is color
        }
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