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 6636199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:09:22+00:00 2026-05-25T23:09:22+00:00

I encountered a problem while practicing html. When I used parentNode in JavaScript, I

  • 0

I encountered a problem while practicing html. When I used parentNode in JavaScript, I thought it is not hard to treat.

But to get some element under parentNode using getElementById or another function is not working as my thinking.

var this_question = selectObj.parentNode.parentNode;
    alert(this_question); //it is working perfectly
    alert(this_question.getElementById('question'))

It’s not working. I can’t understand…

<script>
function addQuestion(selectObj) {
    var this_question = selectObj.parentNode.parentNode;
    alert(this_question); //it is working perfectly
    alert(this_question.getElementById('question')) //It's not working. I can't understand..
}
</script>

<ol id="question_list">
    <li>
        <textarea class="question" name="question" id="question"></textarea>
        <select name="question_type" id="question_type" onChange="javascript:selectEvent(this)">
            <option>-----</option>
            <option value="text" >단답형</option>
            <option value="paragraph" >서술형</option>
            <option value="multiple_choice">다지선</option>
            <option value="checkbox">다중선택</option>
            <option value="scale">scale</option>
        </select>   

        <div id='answer_div'><p>부가설명:<input name='top_label' id='top_label' type='paragraph' /></p> <p>답변:<input name='answer_text' id='answer_text' type='text' /></p></div>

        <p>
            <input type="button" value="Add Question" onclick="javascript:addQuestion(this)"/>
            <input type="button" value="Done" onclick="javascript:finish()"/>
         </p>
    </li>
</ol>
  • 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-25T23:09:23+00:00Added an answer on May 25, 2026 at 11:09 pm

    You have two elements with the same id attribute but id attributes must be unique:

    1. <ol id="question">
    2. <textarea class="question" name="question" id="question"></textarea>

    When you duplicate id attributes strange things happen. If you change the <textarea> to have id="question_text", for example, things start working better:

    http://jsfiddle.net/ambiguous/67DZr/

    From the HTML4 specification:

    id = name [CS]
    This attribute assigns a name to an element. This name must be unique in a document.

    and from the HTML5 specification:

    The id attribute specifies its element’s unique identifier (ID). The value must be unique amongst all the IDs in the element’s home subtree and must contain at least one character.

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

Sidebar

Related Questions

I've encountered an curious problem while trying to use some objects through JSNI in
I encountered a problem some days ago while working with Generic TList in the
I've encountered a problem while writing code in Delphi. Namely I can't get acces
While converting an old code, I encountered the following problem. Given an HTML string,
I've encountered this problem (while trying to add SQL Server Database (.mdf) file to
I've encountered an interesting problem while developing for our legacy XWindows application. For reasons
while designing my user control, i encountered the following problem: i would like to
I encountered a problem when running some old code that was handed down to
I have encountered this problem a few times, and am not able to figure
I wrote a server based on Twisted, and I encountered a problem, some of

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.