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

  • Home
  • SEARCH
  • 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 8406803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:12:42+00:00 2026-06-09T23:12:42+00:00

I am creating a jquery object like so: htmlCode = $(<div id=’+data.layoutDescriptions[i].id+’></div); It seems

  • 0

I am creating a jquery object like so:

 htmlCode = $("<div id='"+data.layoutDescriptions[i].id+"'></div");

It seems to be missing some elements mainly when I am doing this:

if(data.type == "ListView"){

    htmlCode.append("<SELECT property='"+ data.property +"' size="+ data.listProps.length +" multiple>");
    i = 0;
    while(i < data.listProps.length){

        htmlCode.append("<OPTION value='"+ i+1 +"'>"+ data.listProps[i] +"</OPTION>");
        i++;
    }
    htmlCode.append("</SELECT>");

} 

where data is a Json object.

When i do this as a string it works. e.g.
instead of

htmlCode.append("<OPTION value='"+ i+1 +"'>"+ data.listProps[i] +"</OPTION>");

i would do

htmlCode = htmlCode + "<OPTION value='"+ i+1 +"'>"+ data.listProps[i] +"</OPTION>";

I want to find out what is missing so I want to see the Object
i have tried the following:

alert(JQuery.htmlCode.stringify());

alert(htmlCode.html);

Nether work.

Any Ideas??

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-06-09T23:12:44+00:00Added an answer on June 9, 2026 at 11:12 pm

    Your first line of code

    htmlCode = $("<div id='"+data.layoutDescriptions[i].id+"'></div");
    

    declares the variable htmlCode as a jQuery object containing a single <div> element (defined by the HTML you passed to the function).

    When you call

    htmlCode.append("<SELECT property='"+ data.property +"' size="+ data.listProps.length +" multiple>");
    

    you’re appending a <select> element (again, defined by the HTML passed to the function) to the end of that <div> element, which works fine.

    However, when you call

    htmlCode.append("<OPTION value='"+ i+1 +"'>"+ data.listProps[i] +"</OPTION>");
    

    you’re also appending an <option> to the <div> element, not to the <select> element which is what you want.

    It seems like you’re trying to build a HTML string using a jQuery object and the .append() function, but that’s not what jQuery does. jQuery works with actual elements, it just lets you pass HTML to create them.

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

Sidebar

Related Questions

I am assigning some data to html objects by a jquery I'm creating, the
I'm creating DOM elements dynamically (more specifically, using jQuery to create a DIV containing
I am creating a few DOM elements dynamically like, var anchorElement = jQuery('<a />',{text:property.text});
I am creating and sending a JSON Object with jQuery, but I cannot figure
When creating or editing object sin my table, I have a jquery dialog that
I'm creating a Django/JQuery/MySQL application where I pass a composite data structure 'grid' as
I am using jQuery1.4.2, ASP.NET MVC 2 and jQuery.UI-1.8. I am creating a data
I want to execute some code only when all images in a jQuery object
in django I am creating data series using datetime.date() objects, like this: data.append([ddate, daily_score])
I am creating a Javascript object that contains a function that executes a jQuery

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.