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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:48:56+00:00 2026-06-08T16:48:56+00:00

i been reading for hours trying to make this work but i dont have

  • 0

i been reading for hours trying to make this work but i dont have much knowledge to do it.

I have this js code:

var username=$(this).attr("username");

It pull a list of users f.e (admin, test1, test2, test3)

and i needs to split it into another var like this:

var members = [
    ['admin'],
    ['test1'],
    ['test2'],
    ['test3'],
];

I tried a lot of codes but i cant make it work, thanks in advance!

  • 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-08T16:48:56+00:00Added an answer on June 8, 2026 at 4:48 pm

    To get an array of usernames:

    var username = $(this).attr("username");
    var members = username.split(',');
    

    To get exactly what you’ve suggested you want (an array of arrays? – I don’t think this is actually what you want):

    var username = $(this).attr("username");
    var membersArr = username.split(',');
    var members = new Array();
    
    for (var i = 0; i < membersArr.length; i++)
    {
        members[i] = [ membersArr[i] ];
    }
    

    To get “[test1]”, “[test2]” etc:

    var username = $(this).attr("username");
    var members = username.split(',');
    
    for (var i = 0; i < members.length; i++)
    {
        members[i] = '[' + members[i] + ']';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been reading articles about clipping now for hours now but I dont
for the last hour I have been trying to figure this out myself but
I've been trying to get this working for a couple of hours now but
I have been reading stackOverflow answers for this question for hours. Please help me.
i've been reading a lot and have been trying to get this done for
Sorry for asking a basic question like this but I've been reading on this
I have a problem that I have been trying to figure out for hours
I really have no idea how to approach this. I've been reading for like
I have been trying to figure out why this PL/SQL purge script runs slowly
Well, I've been reading 2 hours about mysql_real_escape() and addslashes() and stuff, but my

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.