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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:27:06+00:00 2026-06-16T06:27:06+00:00

I want to serialize my div section using jquery .serialize() . I know that

  • 0

I want to serialize my div section using jquery .serialize(). I know that we can only serialize the form with this function. So for this i created the clone of my div section and append it in the newly created form element and than serialize. The other input fields are serializing but the select list value are not ( the selected value is not in the serialized string). I have created a JSFIDDLE :

http://jsfiddle.net/mj6Eg/1/

Html

<div id="serializethis">
<label>Quantity</label>
<select id="quantity" name="Quantity" size="1">
  <option value="1">1</option>
  <option value="5">5</option>
  <option value="25">25</option>
  <option value="50">50</option>
</select>
</div>

<button id="serialize">Serialize</button>​

JS

$("#serialize").click(function(){

    var clone = $("#serializethis").clone();
    var form = $("<form />").append(clone);

    alert(form.serialize());

});​

What i am missing ?

  • 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-16T06:27:07+00:00Added an answer on June 16, 2026 at 6:27 am

    When clone()-ing an element its selected value is lost. So your code won’t work. The easiest solution would be keeping a <form> around the elements the whole time (unless you use HTML5 that’s required anyway).

    Another solution would be temporarily wrapping your elements in a form:

    $("#serialize").click(function() {
        var data = $("#serializethis").wrap('<form>').parent().serialize();
        alert(data);
        $("#serializethis").unwrap('form');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery/jQueryUI I want to populate a form using this HTML/JS show below. The
$.fn.serialize() is close to what I want except that it only applies for <form>
I am using Dojo Toolkit and I want form elements to serialize into array,
I want to generalize this: <html> <script src=http://code.jquery.com/jquery-latest.js></script> <script> $(function(){ $('#target1').click(function() { $.post(process_form.php, $(#JqPostForm1).serialize(),
I'm using (form).serialize to POST a form with ajax... Something like: $.post(/ajax/post_message_action.php, $(form).serialize(), function
I have login form which i want to send via ajax using serialize but
I want to load form dynamically using following : HTML : <div id=add_new style=display:none>
I want to submit a form using ajax in the background. I tried: <div
Say I have this <div id=x data-id='1' data-prop1='peace' data-prop2='out'>Text</div> in jQuery i can get
I want to use a cloned div that contains a form to insert 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.