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

150
Views
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
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!