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
userscript - how to edit style in html textarea element
<textarea data-a-target="chat-input" data-test-selector="chat-input" aria-label="Send message" class="ScInputBase-sc-1wz0osy-0 ScTextArea-sc-1ywwys8-0 kYJGMC InjectLayout-sc-588ddc-0 iZLAMf tw-textarea tw-textarea--no-resize" autocomplete="twitch-chat" maxlength="500" placeholder="Send message" rows="1" style="padding-right: 6.5rem; padding-left: 3.8rem;"></textarea>

i want to add line-height: 1.0; into textarea element style but i have no idea to do it

(function() {
    'use strict';

    var textarea = document.querySelector("textarea")
    textarea = textarea.replace("style=\"padding-right: 6.5rem; padding-left: 3.8rem;\"","style=\"padding-right: 6.5rem; padding-left: 3.8rem; line-height: 1.0;\"");
})();
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

There is a style property to accomplish that:

document.querySelector("textarea").style.lineHeight = 1.0;
<textarea
      data-a-target="chat-input"
      data-test-selector="chat-input"
      aria-label="Send message"
      class="
        ScInputBase-sc-1wz0osy-0
        ScTextArea-sc-1ywwys8-0
        kYJGMC
        InjectLayout-sc-588ddc-0
        iZLAMf
        tw-textarea tw-textarea--no-resize
      "
      autocomplete="twitch-chat"
      maxlength="500"
      placeholder="Send message"
      rows="1"
      style="padding-right: 6.5rem; padding-left: 3.8rem"
    ></textarea>

Also, if you insist on modifying inline style directly, you might want to use this:

const textarea = document.querySelector("textarea");

textarea.setAttribute("style", textarea.getAttribute("style") + "; line-height: 1.0;");
<textarea data-a-target="chat-input" data-test-selector="chat-input" aria-label="Send message" class="
        ScInputBase-sc-1wz0osy-0
        ScTextArea-sc-1ywwys8-0
        kYJGMC
        InjectLayout-sc-588ddc-0
        iZLAMf
        tw-textarea tw-textarea--no-resize
      " autocomplete="twitch-chat" maxlength="500" placeholder="Send message" rows="1" style="padding-right: 6.5rem; padding-left: 3.8rem"></textarea>

about 4 years ago · Juan Pablo Isaza Report

0

You can use something like the code bellow:

document.getElementById('myID').setAttribute('style', 'background-color: black; color: white');
<input id="myID"></input>

about 4 years ago · Juan Pablo Isaza 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!