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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:53:35+00:00 2026-05-20T17:53:35+00:00

I am writing a plugin using the standard authoring pattern for jQuery, using methods

  • 0

I am writing a plugin using the standard authoring pattern for jQuery, using methods to do different things with, and I’m running into a problem with .each().

I understand from the docs about the difference between $.each() and $(selector).each() yet I can’t figure out how to overcome my problem…

In my code I have a method that returns an object which has been stored using $(selector).data() which I can run a $.each() on like so:

$.each($(selector).maps('getdetails'), function(key, value){/* stuff here */});

However, in the scope of jQuery chainability, this isn’t how it should be, and I can’t understand how to do it like this:

$(selector).maps('getdetails').each(function(key, value){/* stuff here */});

For chainability and ease of use for the user, the latter is preferable. Yet I always get the following error:

TypeError: $(selector).maps("getdetails").each is not a function

Here is the method in question from within the variable object:

getdetails: function(){
    return $(this).data('maps').details;
},

(Yes, before you say it, I know this is incorrect JS, but as I said, it is correctly wrapped in a variable {} in my code.)

Does anyone know how I can manipulate this object into a jQuery object that the latter .each() function will iterate over?

  • 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-20T17:53:36+00:00Added an answer on May 20, 2026 at 5:53 pm

    I assume details is an array, which is why details.each is not going to work. You’ll need to convert details to a jQuery.init object (the map of jQueried objects), which is done simply by throwing it into the jQuery function:

    return $( $(this).data('maps').details );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using jQuery a long time and I've been writing a slideshow plugin
I'm writing a jQuery plugin and using .on and .trigger as my pub/sub system.
I'm writing a jQuery plugin for work which pulls in RSS feed data using
I'm writing a semi-generic form plugin using jQuery in order to speed up the
I wanted to create simple plugin using jquery. Also suggest me standard practice while
I am writing a jQuery animation plugin using sequence of images.. I need to
So, I'm writing my first plugin. I'm using the advice on the jQuery website
I've been using Bamboo for 3 weeks and I'm busy writing a plugin to
I'm writing a C++ plugin in Mac OS X using the Carbon framework (yeah,
I'm trying to learn vimscript by writing a small plugin to display marks using

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.