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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:37:20+00:00 2026-06-13T00:37:20+00:00

I have a HTML as below. Please tell me how can I retrieve the

  • 0

I have a HTML as below.
Please tell me how can I retrieve the value ‘task’ array in jQuery.

<div class="column1">
<input class="task_name" type="text" placeholder="Enter task name.." value="" name="task[0][name]">
</div>
<div class="column2">
<select class="task_ppl_required" name="task[0][number]">
    <option selected="selected">1</option>
    <option>2</option>
</select>
<input class="task_id" type="hidden" value="0" name="task[0][guid]">
</div>
<div class="column1">
<input class="task_name" type="text" placeholder="Enter task name.." value="" name="task[2][name]">
</div>
<div class="column2">
<select class="volunteer_task_ppl_required" name="task[2][number]" value="1">
<option selected="selected">1</option>
<option>2</option>
</select>
<input class="task_id" type="hidden" value="0" name="task[2][guid]">
</div>
  • 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-13T00:37:21+00:00Added an answer on June 13, 2026 at 12:37 am
    function getValues(form) {
        var vals = {};
        form.find("[name]").each(function() {
            var names = this.name.split(/[[\]]+/);
            if (names[names.length-1] == "") names.pop();
            var obj = vals;
            for (var i=0; i<names.length-1; i++) {
                if (! (names[i] in obj))
                    obj[names[i]] = {};
                obj = obj[names[i]];
            }
            obj[names[i]] = this.value;
        });
        return vals;
    }
    

    Instead of .find("[name]") you also could just use .serializeArray(), which might be more exact and allow more inputs. Now, you can

    > getValues($myForm).task[0]
    {number: "1", guid: "0"}
    

    (Demo at jsfiddle.net, more sophisticated using Array.reduce)

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

Sidebar

Related Questions

Please see the form HTML code below <form method=post action=register> <div class=email> Email <input
I have below html code <div id=divTest> Hello <input type=text id=txtID value= /> <input
I have below html code in my aspx. <input type=hidden id=medicalLink value='<a href=/forms/contactus.aspx >Contact
I have below html: <div class=threeimages id=txtCss> <a> <img alt=Australia src=/Images/Services%20button_tcm7-9688.gif/> </a> <div class=text
If I have the HTML below: <div style=display:none;> <span id=hello>Hey</span> </div> And I do
I have below html code in one of the opensource project. <form action=/wiki/bin/view/Main/Search> <div
I am using jQuery UI 's tab view. I have included my HTML below,
In the below shown html i have this main div as cxfeeditem feeditem and
I have HTML code like below <input type = textarea id=sentence1> Here is my
I have below html <table class=Newuser cellspacing=0 cellpadding=0 border=0 id=ctl00_ContentPlaceHolder2_CreateUserWizard1> <tr> <td> <table> <tr>

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.