Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3594384
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:42:21+00:00 2026-05-18T19:42:21+00:00

i posted another question about this, but i think this one will be more

  • 0

i posted another question about this, but i think this one will be more concise.

i’ve dynamically created a text field with javascript. i’ve checked to see that it’s in the DOM by getting its value, but when trying to access it from another function i get a value of null for the input object. is it actually possible to get the current value from a dynamically created text field?

inside one function:

comment_field = 'comment-HE382U3-2';
document.getElementById(comment_field).value = 'Write a comment...';

inside the other:

comment_field = 'comment-HE382U3-2';
if (document.getElementById(comment_field).value == 'Write a comment...')
    { document.getElementById(comment_field).value = '';}

is not happening because there is no [HTMLInputObject] found in the DOM. Please help. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:42:22+00:00Added an answer on May 18, 2026 at 7:42 pm

    is it actually possible to get the current value from a dynamically created text field?

    Yes. It is just like any other element. If it is in the DOM, it is accessed the same way.

    Verify the value of the comment_field variable. You’re making reference to different functions, so perhaps that variable is out of scope.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have already posted another question about this, but no one seemed to know
I posted another one on this,, but i had to edit it really much...
I posted another question about the Roberts operator, but I decided to post a
I have a question about this question . I posted a reply there but
This is similar to another question I posted, but I was told to split
Following on from a question I posted yesterday about GUIs, I have another problem
This question is related to another question I just posted . I'm prepping for
An answer posted for one of my previous questions brings up another question; I
I posted another question earlier about getting the arguments from a context menu App.
This is a spin off from another question I posted a few days ago

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.