Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda