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

131
Views
How can I submit form using javascript dom manipulation with input value

I want to click the submit form button using javascript DOM manipulation with the textarea value. I have another button if I click on the button the form will be submitted.

<form class="sendXMPPMessage">
            <button type="submit" class="btn send-button fa fa-paper-plane" title="Send the message"></button>

            <textarea type="text" class="chat-textarea suggestion-box__input
                    chat-textarea-send-button
                    " placeholder="Message" aria-autocomplete="list" spellcheck="false"><!----><!----></textarea>
            <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>
     
</form>

<button class="submit-message">Submit</button>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You could do this. You can listen to click event on .submit-message button and then once that is clicked call click method on .send-button

document.querySelector('.submit-message').addEventListener('click', () => {
  document.querySelector('.send-button').click()
})
<form class="sendXMPPMessage">
  <button type="submit" class="btn send-button fa fa-paper-plane" title="Send the message"></button>

  <textarea type="text" class="chat-textarea suggestion-box__input
                    chat-textarea-send-button
                    " placeholder="Message" aria-autocomplete="list" spellcheck="false"><!----><!----></textarea>
  <span class="suggestion-box__additions visually-hidden" role="status" aria-live="assertive" aria-relevant="additions"></span>

</form>

<button class="submit-message">Submit</button>

about 4 years ago · Santiago Trujillo Report
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!