[Solved] jQuery multiple getElementByID

I think this will help you to achieve your goal. I have removed some unwanted details from your example, and try to keep it as simple as possible. <div class=”action” > <span class=”MyBtn” rel=”myModal1″ style=”color:orange”>Title 1</span> </div> <!– The Modal 1 –> <div id=’myModal1′ class=”modal” style=”display:none”> <!– Modal content 1 –> <div class=”modal-content”> <div class=”modal-header”> … Read more

[Solved] Find hrefs value in string

Extend the capturing group around the “one or more not white space” LinkParser = new Regex(@”\b(?<url>https?://\S+)[‘””]”, RegexOptions.Compiled | RegexOptions.IgnoreCase); Then access the match collection with m.Groups[“url”].Value A simpler pattern might also work well: \b(?<url>http.*?)[‘”] These are very primitive and I wouldn’t guarantee it works in all cases. If you have urls that aren’t quoted at … Read more

[Solved] heeelp, i keep getting a read underline under foreach [closed]

Using foreach on a string will produce a sequence of char, so declaring part as a string is not valid. Declare part as char or use var. do { //string test = questions[qCounter] = objReader.ReadLine(); string test = question.Split(‘?’)[qCounter]; qCounter++; foreach (char part in test) { Console.WriteLine(part); Console.ReadLine(); } } while (objReader.Peek() != -1 && … Read more

[Solved] For Loop with Lambda Expression in JAVA

I think the reason is pretty clear. ints.forEach((i) -> { System.out.print(ints.get(i-1) + ” “); }); Translates approximately to: for (Integer i : ints) { System.out.println(ints.get(i – 1) + ” “); } Which will cause IndexOutOfBoundsExceptions because i refers to the elements of each list, and each of those elements – 1 will give an index … Read more

[Solved] How to print key value pair in Laravel using foreach loop [closed]

Your code is a mess. here is a cleaner version without using the models (since you did not say if they are in place) Controller Code public function show_friend_request() { $user_id = auth()->user()->id; $senderIds = DB::table(‘friendships’)->where(‘recipient_id’, $user_id)->where(‘status’, ‘pending’)->pluck(‘sender_id’)->toArray(); $activeRequests = DB::table(‘users’) ->whereIn(‘id’, $senderIds) ->get([‘first_name’,’last_name’]); return view(‘pages.friend_request’)->with(‘activeRequest’, $activeRequests); } Blade Code @foreach($activeRequest as $key => $friend) … Read more

[Solved] Increase the speed of this code? Foreach

Might be slightly faster, I haven’t tested, but if [‘Data’][‘Show’] will be true or false then this is how I would do it: $pass = array_filter($var, function($v) { return $v[‘Data’][‘Show’]; }); If it could be other values that evaluate to false then: $pass = array_filter($var, function($v) { return $v[‘Data’][‘Show’] !== false; }); solved Increase the … Read more

[Solved] Warning: foreach staement

You need to have array in $_POST[‘quantity’] but you have something else, do var_dump($_POST[‘quantity’]); to see what inside $_POST[‘quantity’]. Also you can change if(!empty($_SESSION[‘cart’])) to if(!empty($_SESSION[‘cart’]) && is_array($_POST[‘quantity’])) solved Warning: foreach staement

[Solved] Condition inside table [closed]

Do you mean something like the following? echo ‘<td>’ . ($data[‘temperature’] < 5 ? ‘Cold’ : ‘Warm’) . ‘</td>’; The above uses the ternary operator as a contracted if/else within a table cell. 1 solved Condition inside table [closed]

[Solved] Printing key value pair in Laravel blade using for each loop [closed]

Your code is a mess. here is a cleaner version without using the models (since you did not say if they are in place) Controller Code public function show_friend_request() { $user_id = auth()->user()->id; $senderIds = DB::table(‘friendships’)->where(‘recipient_id’, $user_id)->where(‘status’, ‘pending’)->pluck(‘sender_id’)->toArray(); $activeRequests = DB::table(‘users’) ->whereIn(‘id’, $senderIds) ->get([‘first_name’,’last_name’]); return view(‘pages.friend_request’)->with(‘activeRequest’, $activeRequests); } Blade Code @foreach($activeRequest as $key => $friend) … Read more

[Solved] How to make array inside in foreach loop – php? [closed]

I suppose you’re looking for this: $input = array(“teamA”,”teamB”,”teamC”); $data = []; foreach($input as $value){ $assign = “50”; /* The data just temp */ $data[$value] = $assign; } echo $data[“teamA”]; If $assign is same for all keys: $data = array_fill_keys($input, 50); 1 solved How to make array inside in foreach loop – php? [closed]

[Solved] JavaScript. forEach return an undefined

You need .some to check if any items in an array pass a test. forEach returns undefined: const data = [ {prop1: false, prop2: ‘someValue’}, {prop1: true, prop2: ‘someValue’}, {prop1: false, prop2: ‘someValue’} ] const isSomeProp1EqualToTrue = data.some(({ prop1 }) => prop1 === true); console.log(isSomeProp1EqualToTrue); 4 solved JavaScript. forEach return an undefined