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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:17:23+00:00 2026-06-16T10:17:23+00:00

I cannot figure out for the life of me why this will not work.

  • 0

I cannot figure out for the life of me why this will not work. I am trying to pull the value of a textfield that was created with a loop from a json file.

In this code, at the very bottom I just do a simple click(function() {alert()} just to see if I can pull a value and its returning undefined. But if I remove ‘#name’ and put in ‘input’ it captures it, but only for the first of several input fields.

Any help is really appreciated

JSON

{
"Controls": [{
    "Button":[{ "Name":"Button", "x": "1","y": "2","width": "3","height": "4","Transition":"" }],

    "Image":[{"x": "5","y": "6","width": "7","height": "8"}],

    "TextField":[{"x": "9","y": "10","width": "11","height": "12","Rows":""}]
}]

}

The Code(there is soome getJSON stuff above this)

//Slide In Attributes Panel Based on Selected Object
$(document).on('click', '#code li', function () {
    var index = $('#code li').index(this);
    var selected = $(this).text();
    switch (selected) {
        case selected:
            $('#options').hide();
            hidePanels();
            $('#temp').remove();
            $('#objectAttributes').show("slide", 200);
            break;

        //If it does work show what variable is being used
        default:
            alert(selected);
            break;
    }

    //Shows Selected LI Index
    $('#codeIndex').text("That was div index #" + index);

    //Pull list of Attributes for selected Object
    $.getJSON('controls.json', function (data) {
        //Build Attributes List
        var attributeList = '<div id="temp">';
        //Target based on selected object
        var target = selected;
        attributeList += '<div>' + target + '<div>';
        $.each(data.Controls[0][target][0], function (kk, vv) {
            attributeList += '<div style="float:right">' + kk + ':' + '<input type="text" id='+ kk + '>' + '</input>' + '</div>';
        });
        attributeList += '</div></div>';
        attributeList += '</div>';
        $('#objectAttributes').append(attributeList);
        $('#temp').append('<div id="editIndex">'+"Modifying index" + " " +index+'</div>');

        $(document).on('click', '#saveAttributes', function () {
            var $x = $('#name').val();
            alert($x);
        })
    });


});
  • 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-06-16T10:17:24+00:00Added an answer on June 16, 2026 at 10:17 am

    Ok, so after a little hacking around with a jsfiddle the answer turned out to be a lot simpler than I first thought. Ever since HTML 4.01 class names and IDs have been case sensitive (reference), which means that your selector $('#name') wasn’t matching the JSON Name.

    So a simple change, such as in this simplified jsfiddle seems to work as desired. Hopefully this helps!

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

Sidebar

Related Questions

I for the life of me cannot figure out why this is not working.
For the life of me, I cannot figure out why this program does not
I cannot figure out why this doesn't work. It seems so simple. It should
For the life of me, I cannot figure out the cause of this: when
For the life of me I cannot figure out why this is happening to
For the life of me, I cannot figure out anything about this topic. Maybe
This seems to be a very odd problem that I cannot figure out for
For the life of me, I cannot figure out why the code at www.moosecodes.com
I cannot for the life of me figure out why my table is turning
For the life of me, I can not figure out why some styles are

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.