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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:28:08+00:00 2026-06-15T22:28:08+00:00

Is it possible to query the length of an array and then use JS/jQuery

  • 0

Is it possible to query the length of an array and then use JS/jQuery to create the same amount of new HTML elements client side?

The code I have for the array is:

var psC1 = [
'item1',
'item2',
'item3'
];

alert(psC1.length);

Which will alert that there’s 3 items in the array. I now want to create three iframes on the page, and index the array into the src attribute of each element.

The code I’d use to insert the src of the iframes using the array would be:

  $('.test-iframe').each(function() {
    $(this).attr('src', psC1[$(this).index()]); 
   });

What I’m struggling with is after counting the array, is creating three iframes with JS/jQuery.

  • 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-15T22:28:09+00:00Added an answer on June 15, 2026 at 10:28 pm

    To create an iframe with jQuery, you use the $ function (or jQuery in no-conflict mode):

    $("<iframe>").appendTo(document.body);
    

    Of course, you don’t have to append to body, you can put the iframe wherever you need it.

    In your case, perhaps something like this:

    $.each(psC1, function(index, value) {
        $("<iframe>").attr("src", value).appendTo(document.body);
    });
    

    $.each loops through the array entries.

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

Sidebar

Related Questions

Is it possible to sort a query object by the length of a varchar
Possible Duplicate: MySQL query using an array Passing an array to mysql I have
Is it possible to query for specific objects within a nested document? Heres an
Is it possible to query using Facebook Query Language when not currently logged in
Is it possible to query Google's cache with a specific date range. for instance,
Is it possible to query data from a Model without writing sqarql-queries? Adding properties
I have an Exchange account with multiple calendars defined. Is it possible to query
Is it possible to perform query expansion with Lucene 3.6 using any ontology? I've
Possible Duplicate: SQL Server Database query help Hi, I have a problem that I
Possible Duplicate: php/Mysql query with inserting date fails I have a datepicker code below:

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.