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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:16:59+00:00 2026-06-03T02:16:59+00:00

I am using the .data() function in jQuery to store an array as per

  • 0

I am using the .data() function in jQuery to store an array as per below:

var myArray = {};
myArray[0] = {};
myArray[0][0] = "test00";
myArray[0][1] = "test01";
myArray[1] = {};
myArray[1][0] = "test10";
myArray[1][1] = "test11";

$('#datastorage').data("testname". myArray);

I want to remove only one item (myArray[0]) from the “testname” and keep the rest.

The below does not work:

$('#datastorage').removeData("testname").removeData(0);

I believe jQuery stored the array in a form of a plain object (the test $.isPlainObject() comes back true)
I am now trying to use the function .not() to remove the element…

  • 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-03T02:17:01+00:00Added an answer on June 3, 2026 at 2:17 am

    Since the original object is an array, what’s actually stored is just a reference to the original data, so any modification you make is reflected in every reference to that array, including the one stored in .data().

    So you can just remove the element from the array:

    $('#datastorage').data("testname").shift();
    

    or if you want more flexibility on which elements are removed, use .splice().

    $('#datastorage').data("testname").splice(0, 1);
    

    or if you’ve still got access to myArray:

    myArray.shift();
    

    There’s no need to put the array back into .data() – any of the above will modify both myArray and whatever’s already in .data() – they’re the same array!.

    The same would apply if the data was an object, but not if it’s a primitive type.

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

Sidebar

Related Questions

I am attempting to pase a a JSON data using the JQuery getJSON function.
I'm using the JQuery AJAX function to deliver data to a PHP doc. Currently,
I have written a form using the jQuery .post() function to post the data
I'm trying to make simple script using jquery $post function to pass data to
I'm developing code using jQuery and need to store data associated with certain DOM
I'm using the JQuery Autocomplete plugin, with l ocal data stored in a array
How can I read and sign XML data (array of different sizes) using jQuery?
so im using a simple submit binding to pass a function data: <form data-bind=submit:
I am using a trigger function to write data into a new table in
I am using a function to import data from a access db into SQL

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.