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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:21:37+00:00 2026-05-23T05:21:37+00:00

I have the following jquery code: $(‘.menubox’).children(‘div’).toArray().map(function(n,i){ return [$(n).children(‘input’).val(),$(n).children(‘.subs’).children(‘div’).toArray().map(function(n,i){ return [$(n).children(‘input’).val(),$(n).children(‘.subs’).children(‘div’).toArray().map(function(n,i){ return $(n).children(‘input’).val(); })];

  • 0

I have the following jquery code:

$('.menubox').children('div').toArray().map(function(n,i){
            return [$(n).children('input').val(),$(n).children('.subs').children('div').toArray().map(function(n,i){ 
                    return [$(n).children('input').val(),$(n).children('.subs').children('div').toArray().map(function(n,i){ 
                            return $(n).children('input').val(); 
                        })];
                })];
        });

This is the HTML to go with that:

        <td class="menubox">
        <div class="draggable droppable lvl0">
            <input type="hidden" value="-" />
            LBL1
            <div class="subs"></div>
        </div>
        <div class="draggable droppable lvl0">
            <input type="hidden" value="-" />
            LBL2
            <div class="subs">                  
                <div class="draggable droppable lvl1">
                    <input type="hidden" value="3" />
                    <b>LBL2.1</b><span style="display:block;"><a class="deleteItem">verwijder</a></span>
                    <div class="subs"></div>
                </div>                  

                <div class="draggable droppable lvl1">
                    <input type="hidden" value="6" />
                    <b>LBL2.2</b><span style="display:block;"><a class="deleteItem">verwijder</a></span>
                    <div class="subs"></div>
                </div>                  
            </div>
        </div>
    </td>

It works fine in chrome but IE throws an error:

Error: Object doesn’t support this property or method

When I remove the map() function, the error is gone. What am I doing wronge here?

  • 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-23T05:21:38+00:00Added an answer on May 23, 2026 at 5:21 am

    What am I doing wronge here?

    Calling .toArray() on a jQuery object. Remove those calls, and add .get() after .map() if you want to end up with a vanilla JS array. Note that jQuery’s .map() callback takes index, element while Array.map‘s callback takes element, index so you also need to swap the argument names.

    var results = $('.menubox').children('div').map(function(i, n)
    {
        return [
            $(n).children('input').val(),
            $(n).children('.subs').children('div').map(function(i, n)
            {
                return [
                    $(n).children('input').val(),
                    $(n).children('.subs').children('div').map(function(i, n)
                    {
                        return $(n).children('input').val();
                    }).get()
                ];
            }).get()
        ];
    }).get();
    
    console.log(JSON.stringify(results));
    // ["-",[],"-",["3",[],"6",[]]]
    

    This works in Chrome but not IE since Chrome supports Array.map() but (surprise, surprise) IE <9 do not.

    Demo: http://jsfiddle.net/mattball/5KBdA/

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

Sidebar

Related Questions

i have the following jquery code: $(document).ready(function() { $('.restrictiveOptions input[type!=checkbox], .restrictiveOptions select').change(function() { //
I have the following jQuery code-- $('div#mid_number_of_mail').mouseover(function () { setTimeout(function () { $('div.element_popup' ,this).stop().animate({
I have the following jQuery code: $('a[rel=close]').click(function() { alert('Close click!'); $('div#purchasePanel').hide(); }); This is
I have the following jQuery code: $(.save_button).click(function() { var $form = $(this).closest(div.info_section).find(form); url =
I have the following jQuery code that works: $(document).ready(function () { $(input[id^='pos_']).change(UpdatePosition) }); function
I have the following jQuery code: $("#someTextInputID").keydown(function(event){ console.log(event.keyCode); console.log("input_box.val(): "+input_box.val()); console.log("input_box.val().length: "+input_box.val().length); }) What
I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
i have the following jquery code to format a html table. $(.jtable td).each(function() {
I have the following jQuery code $(#dropdown).hover(function() { $(this).stop(true,true).fadeTo('fast',1); $(#options).stop(true,true).slideDown(); }, function() { $(this).delay(1000).stop(true,true).fadeTo('fast',0.1);

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.