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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:05:16+00:00 2026-05-13T18:05:16+00:00

I am using jQuery 1.4.1 and here is a simple code. buildCol1: function() {

  • 0

I am using jQuery 1.4.1 and here is a simple code.

buildCol1: function() {
  var col = $('<select />', {className: 'col1' }).append($('<option />'));
  return $('<td />').append(col);
},

I am using qunit . In this case the method call is returning a jquery element. Since I am writing a test I should have something like

s = "<td><select class='col1'><option></option></select></td>"

I am not sure how do I get the fully expanded text value from a jquery element. I am sure I can get that by fully treaversing all the children. But I am hoping that there is an easier way to unit test this method.

Update:

After I posted the question I got an idea that on the returned element I can check for class name and for the right count of children. Basically this will be like inspecting the returned td to have right values.

  • 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-13T18:05:16+00:00Added an answer on May 13, 2026 at 6:05 pm

    So, you want to get the plain HTML source of a jQuery selection? The solution is to put it into a containing element and get that element’s inner HTML:

    var $myEl = $('<select />', {className: 'col1' }).append($('<option />'));
    var src = $("<div></div>").append($myEl).html();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Kill Ajax requests using JavaScript using jQuery Here is the simple code
I'm using jquery to submit my form (with id #myForm here) as follows: $(document).ready(function()
Here's a dead-simple webpage that leaks memory in IE8 using jQuery (I detect memory
I'm having an issue with <optgroup> in Opera using jQuery. First, here's the code:
I'm using a simple jquery code that grabs html code form a tag and
I'm using the ' simple tip ' jQuery tooltip code on my site, which
I have this code & I've tired using JQuery's appendTo() function to get this
I have this simple code : here $(.btn).on('click',function () { $(.a).trigger('click'); }); $(.btn2).on('click',function ()
Here is my simple code to try and test if jQuery resizable is working.
I am using jQuery Accordion here and find some strange behavior when opening a

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.