Working on a project requiring old-school CSS support and want to keep <aside> filling up the page by remaining the same height as the <article> element’s box (It may be between a header and footer, in which case it would not extend past them.) Here’s my attempt at dynamically setting …
Tag: javascript
What am I missing in my function (return an array of element that is greater than the element to its right)?
I need to create a function that finds all elements in the given array, such that each element is greater than all elements to the right of it. Examples Here is my function : The test that makes me fail is when this array is called: Answer Just finding the index of the max element isn’t enough, because …
node js schedule cron job to call express route every week
I have a page that when you access it, it runs tests. I want my tests to run every week so Im trying to create a cron job that access my express route every week. Sort of like Im making a get request. For testing sake I have a cron job that runs every 2 minutes: If I go in
Can I programmatically detect whether a CORB error occurred?
I’m looking for a way to programmatically detect (using JavaScript) whether a resource load on my page (over which I have full control) was blocked by Cross-Origin Resource Blocking. For instance, because the response from https://example.com has Content-Type text/html; charset=UTF-8, the following HTML…
How do I replace a class for a child element?
I have a piece of code that, while it works perfectly elsewhere, is not working when I try to apply it to a child element. I am trying to simply replace a class in the classList for an i element when the addEventListener(“mouseover” for the parent tag is triggered. Here’s my code: This shoul…
How to stop JS scroll to top function overriding links in nav bar
Hi I have a navbar as follows: With a JavaScript function to return to the top of the page when the navbar is clicked as follows: However, I still want to be able to follow the links within the navbar but they are being overridden by the JS function so when you click on them now it scrolls to the
Obtain result of GET request in javascript (and Node.js)
I am trying to get a rudimentary GET request from a Node.js server when I click on a button. server.js client.js However, the console log shows: How can I get my “foobarbaz”? If I go to localhost:8080/clicks the text shows up there. Additionally, the response already seems to be a javascript objec…
Scrolling content when mouse is over a button with absolute position (button should remain clickable)
I am trying to scroll a content while the mouse is over a div or a button. This is important because it feels like the app is stuck if you cannot scroll. But the button should remain clickable. Any ideas on how to achieve this? Steps to reproduce Open example https://codesandbox.io/s/relaxed-wood-bqhxh?file=/…
Prevent click event in Vue conditonally
I am disabling document body scroll when my mobile nav is open which is working as expected. However it was not removing the overflow hidden when user would click a link to another route/page. I created a simple method to remove the overflow hidden when a link is clicked in the nav when the menu is open, whic…
How can I count items in Java Script array but only when items are the same next to each other?
I have an array for example like this {John, John, John, Maria, Peter, Peter, Maria, Anna, Anna, Maria, Maria, Peter} I need to get result like 1 -> 3 2 -> 1 3 -> 2 4 -> 1 5 -> 2 6 -> 2 7 -> 1 Answer I group the names, then I count them.