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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:44:19+00:00 2026-06-10T13:44:19+00:00

I am not a heavy user of Javascript/jQuery, but I have start to really

  • 0

I am not a heavy user of Javascript/jQuery, but I have start to really get into creating my own UI stuff, such as gallery viewer, alert animations, popup forms etc…

But what is the best way to store data to pull together when needed?

For example:
With the gallery viewer, much like Lightbox, I pull in the href of anchors that have the rel=viewer.

<a href="url" rel=viewer" />
<a href="url" rel=viewer" />

I then extended this for admin users to be able to delete these images, but I needed to pass the media id to do this. So I added…

<a href="url" rel=viewer" viewerid="123" />
<a href="url" rel=viewer" viewerid="456" />

I do not like the idea of creating my own attributes, because I will no doubt forget what I have. But is it possible to store a javascript object/array of data within an anchor? Something like…

<a href="url" rel=viewer" data="{'id':'123', 'foo':'bar'}" />

and then…

var photos = new Array();
$('a[rel=viewer]').each(function(){
    photos.push(  new Array( $(this).attr('data') )  );
});

to give me something like

photos[0] = array('id' => 123, 'foo' => 'bar')
photos[1] = array('id' => 456, 'foo' => 'bar')
  • 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-10T13:44:21+00:00Added an answer on June 10, 2026 at 1:44 pm

    as i know data inside tag have to be named? valid syntactic would be

    <a href="url" rel=viewer" data-array="{'id':'123', 'foo':'bar'}" />
    

    and you can read it later like that:

    $('a').data('array')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently creating a site(php,css,html,ajax,MySql) which will have heavy user usage of space(regarding
Not sure how to ask this, but i'll give it a try: I have
I have a few pages with an heavy javascript usage (e.g. sorting and filtering
I've been tasked with creating an extremely heavy JavaScript site that of course must
I have a windows service that invokes some heavy image processing whenever a user
I have a model User where I make heavy use of dynamic attributes. When
The problem: I have a jQuery heavy page that has a built in admin
I have a folder with some heavy restrictions on it. For one user, this
I have a winform application that can get pretty unresponsive during heavy calculations. For
Not ever sure if it can be done, but is it possible to use

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.