Questions tagged [each]

An iterator function or language struct which can be used to iterate over arrays or lists.

Filter by
Sorted by
Tagged with
-3 votes
2 answers
26 views

How to iterate json object

I have the following json object and trying to iterate with jQuery each but it only returns one iteration. What am I not doing right? var data = "{ "SIEcat4": { "3001": { "test": "test"...
Kevin Lindmark's user avatar
1 vote
2 answers
63 views

How to rewrite the undefined function each() correctly in this case?

Updating PHP on old WordPress website got an Uncaught Error: Call to undefined function each() in 186 line of class-vc-mapper.php public function callElementActivities( $tag ) { do_action( '...
Ilya's user avatar
  • 13
0 votes
0 answers
11 views

adding a prefix word to each line in a text file

I have a text file with differnt names on it Albert Peter Sam Eric joel I need to add Mr. before each name in each line in the file using bash. Please guide. Thank you. I tried with variable but I am ...
priya darshini's user avatar
0 votes
1 answer
38 views

How to iterate months in cypress?

I need to learn how to go from June to February with cypress, clicking month by month. My idea is to obtain the value of the month and if it is not the month February, continue clicking the next ...
kenji24's user avatar
1 vote
2 answers
38 views

count number up with XML Elements

I build my XML with my base XML like this: $(xml).find('PARENT').find('CHILDREN').each(function(i){ outputstr += '<lorem id="">' }) now the Object "parent" exists a few ...
TheCodingTentacle's user avatar
1 vote
1 answer
35 views

jquery: Is there a way to run "each" iterations sequentially?

I have a table to manipulate. It contains rows from my database (in descending order). I want to be able to use an array of ids, and remove the matching rows from the table. As I remove each one, I ...
Andy Wallace's user avatar
0 votes
0 answers
18 views

SCSS @Each Nesting Naming Issue [duplicate]

Im looking at nesting @each loops but for the nested version i want to take a value form the parent @each, See below $team-rooms-color: ( lightBlue: #29B0CE, red: #D13B3B, ...
ltjfansite's user avatar
1 vote
2 answers
63 views

Ruby way instead of for loop in specific case of array iteration

Coming from other languages where for loop is predominant way of iterating, I am curious is there a better more Ruby style way to achieve below: q=[5,1,7,9,0,3,6,8,0] for i in 0..q.size/3-1 do one ...
ZoRaN's user avatar
  • 13
2 votes
1 answer
144 views

How to generate gtag item list foreach product using JQuery

Here is a short product list for the reference. I would like to have my gtag generated below the product list. How can I do this? <div class="product"> <div class="name&...
Jurgen's user avatar
  • 213
1 vote
1 answer
30 views

Change anchor link in pop-up window based on clicked link in JQuery

I'm currently helping to build a forum and we want to be able to warn users when they click links that will take them to an external site. At the moment, my code opens the pop-up window and will take ...
pathetic.aesthetic's user avatar
0 votes
1 answer
22 views

Apply jQuery formula to individual div values that contain certain words in class

I have the following block of html: <div class="product BLACKSHIRT"> <span class="displayPrice">£50</span> </div> <div class="product WHITESHIRT&...
Gary's user avatar
  • 101
0 votes
1 answer
34 views

Use only second argument in $.each() function in jQuery

Is it possible to use only the second argument of a $.each function without having to pass both arguments to use it? Let's say I have a function like this: $('.selector').each(function(index, element){...
Leo's user avatar
  • 956
0 votes
1 answer
140 views

How to create a colour gradient in each graph bar python?

This is the current output of my code at the moment. I have this the code: azul das barras rb=0 gb=80 bb=141 color_bar=rgb_to_hex(rb, gb, bb) laranja da linha rl=237 gl=125 bl=49 color_line=...
Carlos Coelho's user avatar
0 votes
1 answer
55 views

How to search all sheet names for values (partial matches)

I have a workbook with multiple sheets in a master roster book which are named based on a roster cycle number. Each roster cycle will have varying named sheets with a common number to designate the ...
BigSteveo's user avatar
0 votes
1 answer
44 views

kdb uses the symbol ' to compare strings one by one

I want to use ' to compare strings in a list, the code is as follows: "tbl" ~'("customer";"tbl") but reported an error:“length: Incompatible list lengths”。 The result I ...
sevenmiracle's user avatar
0 votes
0 answers
22 views

Delay between API calls Node.js [duplicate]

I have a jquery $.each loop feeding a different variable to a POST API call. I am trying to delay the API calls between each variable say 5 seconds, but it is executing all at the same time even with ...
Andrew Lee's user avatar
0 votes
1 answer
111 views

JQuery - $.each within $.each wait for function to finish [duplicate]

I've got an $.each loop, that is within another $.each that is calling a function to add values to my back end system. My $.each loops are like this: $.each(locations, function( i, location ) { $....
Tom's user avatar
  • 1,466
-1 votes
1 answer
39 views

Why isn't this jQuery loop not firing every time?

I have a page (product category in Woocommerce) with 12 products on it. Each product has a quantity field, and when you click a button at the bottom of the page, it loops over the products and adds ...
cx3700's user avatar
  • 1
0 votes
1 answer
39 views

How to correctly update each() function in following example?

Could you please help me to rewrite the piece of code to fit the 8.2 PHP: while ($this->init_activity = each($activity)) { list( $object, $method, $params ) = $activity[1]; The full piece: ...
Ilya's user avatar
  • 13
0 votes
1 answer
60 views

PostgreSQL - How to get all the rows, that are on the last day of each month

I have several tables, where all the data is recorded, day by day. However, I need to make a select that brings all the records of the last day of each month. I've looked around here on Stack and ...
Tarcisio Lopes's user avatar
0 votes
1 answer
68 views

Ruby array not updating when changing values in loop

I wrote this code block (mind all the print statements, I couldn't figure out where the issue was). tablet_arr = [] objects.map do |backup_file| puts backup_file if backup_file == "...
jroj00's user avatar
  • 3
0 votes
0 answers
40 views

Autoincrement / Decrement values in a table on click using Javascript

I have a table that I would like for the total to auto-generate based on the quantity being incremented/ decremented and the cost. This is my current table structure. <table class="table ...
A.Mac's user avatar
  • 213
0 votes
3 answers
45 views

APL2, order of processing each operator arguments

Assuming the user function: ∇ f b [1] b ∇ and the following is executed: f¨1 2 3 Three lines will display, 1 digit per line. In APLX the order is 1 2 3. Is there any APL2 guarantee the order the ...
Paul Houle's user avatar
0 votes
0 answers
25 views

How to call a function with arguments for a button on click event in each block RactiveJS?

I'm using RactiveJS 1.4.1 and asp.net mvc core razor pages. I put the html to a script-template in the page. And call it in RactiveJS to render. Rendering works fine, but button click action, the ...
Lost_In_Library's user avatar
-3 votes
1 answer
327 views

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in [duplicate]

Recently I upgrade my php and suddenly I got this error Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /modules/Downloads/admin/CategoryModify.php ...
Bestbuildpc Net's user avatar
0 votes
0 answers
20 views

Queue two sets of each() functions in jQuery

I am setting up an animation sequence in jQuery on some tabbed HTML content. Example HTML <div id="tabs-2"> <h2 class="majorpt">Pekinese</h2> ...
smallnorthumbrianvillage's user avatar
0 votes
0 answers
73 views

Iterate With jQuery .each() method and grab the current iteration

var selector = $("li.has-submenu .level-2").has("ul#specific-id"); var anchor = $("#specific-id > li > a"); $(selector).keydown(function(e) { if (e.which === 13) { e.preventDefault(); /...
Cephas's user avatar
  • 1
0 votes
1 answer
30 views

how do I filter a json array and return a new field

statuss: [{'is_visible': true, 'status': 1}, {'is_visible': false, 'status': 2}, {'is_visible': true, 'status': 2}] new-statuss: [{'is_visible': true, 'status': 1}, {'is_visible': true, 'status': 2}] ...
bingdujinaer's user avatar
0 votes
2 answers
704 views

Uncaught Error: Call to undefined function each()

I'm wondering if you guys can give me an idea about how to replace this each function: while(list($key,$val) = each($_SESSION['cart'][$i])) { if ($key=="product_name"){ ...
RC.'s user avatar
  • 13
0 votes
0 answers
76 views

Converting each method in Jquery to Javascript for loop

$.each(data.features[i].properties, function(key, val){ items[i][j].push(val); } I'm using this each method in my code with the function which has key and val as the parameters of the function. I ...
Utkrisht Trivedi's user avatar
0 votes
2 answers
82 views

How to detect end of elements in div with jQuery each() on multiple div

I have several divs that have the same class .timeline-travel-steps. These divs contain elements .step that I want to select with jQuery each() Method HTML <div class="timeline-graphic"&...
Sébastien Gicquel's user avatar
-2 votes
1 answer
586 views

PHP 8.0 - How to replace deprecated each() - with foreach()? [duplicate]

I understand that the each function() is deprecated in PHP 8.0. Updated: I'm getting a Fatal error: Uncaught Error: Call to undefined function each() line 742 - [line 742 is this line in the code ...
Ed_B's user avatar
  • 1
0 votes
1 answer
51 views

Ruby each_with_index iteration. Unsure about why else statement is needed

Why do we need hash[number] = index in the following code? nums = [11, 8, 1, 7] target = 9 def two_sum(nums, target) hash = {} nums.each_with_index do |number, index| if complement = hash[...
AlHey's user avatar
  • 3
4 votes
1 answer
110 views

Printing hash of array as values with Dumper leads to infinite recursion

The following code leads to infinite recursion. If printed without Dumper then it works as expected. Why Dumper causes recursion? use Data::Dumper; my %hash1 = ( 'key1' => ['val1'] ); ...
Talespin_Kit's user avatar
  • 20.9k
0 votes
1 answer
32 views

Solution for removed each function in smtp module of drupal 7 on php 8 servers

I noticed an error in smtp.transport.inc of the drupal module smtp 7.x-1.7 because of the in php 7.2 deprecated and in php 8 removed function "each()". Unfortunatelay a customers drupal 7 ...
henrik23's user avatar
0 votes
0 answers
17 views

jquery parseInt on lis [duplicate]

When I run this code I get NaN, but it reads the initial lis correctly. Does .each not work correctly on html elements? function computeTotal() { let total = 0; $("li").each(() => { ...
Justin Kagan's user avatar
0 votes
2 answers
111 views

Ruby - Checking if one array key/value is NOT present in another one

With ruby, I am trying to look from the first array key[:nb].value, if there is NOT one similar pair in the second one. Considerate below arrays contain thousands of elements: arr1 = [{"nb"=&...
Kamilo's user avatar
  • 21
0 votes
2 answers
254 views

jquery, if specific elements contains specific text, change the icon class before this

i have this html code: <div class="online-users"> online users <span class="user-online"> <i class="fa fa-circle"></i> <...
alexikakos's user avatar
0 votes
2 answers
54 views

Ruby - Checking if one array key/value is present in another one

With ruby, I am trying to look from the first array key[:nb].value, if there is one similar pair in the second one. Considerate below arrays contain thousands of elements: arr1 = [{"nb"=>&...
Kamilo's user avatar
  • 21
1 vote
1 answer
165 views

Svelte recomputes too much on change

I'm implementing an app where the user should be able to place things on a 2D grid by clicking on it, and also be able to drag the grid around. I have a functional prototype here: https://svelte.dev/...
Peppe L-G's user avatar
  • 7,351
0 votes
0 answers
13 views

Limiting jquery .each to only images in #main section [duplicate]

I want to set the Title attribute to images inside my #main and filling this title with text "Click for fullscreen". Even if there is no title definied i want to set. Reason: tooltip needs a ...
Ratooren's user avatar
0 votes
1 answer
60 views

#each statement on HTML showing only last item

I need to print in my list all the items of my array, but I'm getting only the last item printed. When I console.log it, I can see all the items. Not sure why this is happening, I tried to figure out ...
jujuzinho's user avatar
0 votes
0 answers
29 views

Google charts dataTable crates paralel arrays inside

Im at coding the app to draw some charts from mysql base using XML The charts is displayed but only with static statment add.Row. When using ajax in Jquery statement add.Row from .each() the data goes ...
Michael Pajdak's user avatar
0 votes
1 answer
20 views

How to get the n-th value and the maximum value of n elements starting from the current position of vector “P“?

I have a table (with column “p” and “nextN”) as follows: p nextN --- ----- 100 1 101 2 102 2 103 1 104 1 105 1 I want to obtain a table with two new columns: take the nextN-th ...
Polly's user avatar
  • 603
-2 votes
1 answer
2k views

How to solve a PHP Fatal error: Uncaught Error: Call to undefined function each()?

Since moving to PHP 8 the code below gave me the error 'PHP Fatal error: Uncaught Error: Call to undefined function each()...' public function Seek($ArrangementID) { $this->populate(); $...
Maurits's user avatar
0 votes
1 answer
46 views

jQuery remove duplicate but keep last occurance

SO is full of these questions, I know, but after going through 20+ pages and numerous google searches I end up asking because I can't find the answer. I want to filter through data attributes and keep ...
purple11111's user avatar
0 votes
1 answer
80 views

PowerQuery: How can I transform a table by dividing the columns by columnspecific factors?

I have a table ("Index") which I want to transform by dividing all columns except "Date" by columnspecific factors. The factors are stored in a table named "normfactor" ...
Katrin's user avatar
  • 7
0 votes
2 answers
38 views

How can I count the keys in list of dictionaries? | python

For example there is a list: list = [{'brand': 'Ford', 'Model': 'Mustang', 'year': 1964}, {'brand': 'Nissan', 'model': 'Skyline', 'year': 1969} ...] I want to count there are how many model from each....
mohamedan's user avatar
-3 votes
1 answer
3k views

Call to undefined function each() in php 8.1 [closed]

I've never got this error before but now since I am running php 8.1 then this piece of code is obsolete. // addslashes to vars if magic_quotes_gpc is off // this is a security precaution to prevent ...
user2583893's user avatar
0 votes
0 answers
51 views

Inner for loop in nested for loop in handlebars is not working

My outer for loop is working and printing name but inner loop in which i'm trying to iterate through systems is not working. var executions = [ { name:'Password', email:'p@pol....
Shashank Rai's user avatar

1
2 3 4 5
78