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

178
Views
Tampermonkey Javascript Set Attribute to Class Name

I'm having some issues setting an attribute to my class name m-date-entry__day-field.

This works: document.getElementById("create-password").setAttribute("value", "ye345s345");, but only supports Id.

I have tried getElementByClassName, without any success.

Element: <input class="m-date-entry__day-field" type="number" name="day" min="1" max="31" pattern="\b^(0?[1-9]|[1-2][0-9]|3[0-1])$\b" value="" placeholder="DD" required="" data-date="" data-date-day="" data-test="date-entry-day" tabindex="4" autocomplete="bday-day">

So my end goal is just wanting to set the attribute "1".

Any ideas why document.getElementByClassName("m-date-entry__day-field").setAttribute("value", "1");

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!