Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Posts tagged javascript
I'm trying to create an automatic text-to-link conversion feature in a TypeScript application. The desired workflow is: Copy a URL to the clipboard Select some text Paste the URL - this should...
My redirect in javascript somehow gets "hijacked" and I don't understand how. Previous developer (who is no longer working with the company) on page load initialized onbeforeunload event like so: ...
I am all new with using Redux Toolkit, I followed the official documentation to setup the store: // store.ts import { configureStore, ThunkAction, Action, combineReducers } from '@reduxjs/toolkit...
I wanna make a form in React native. A field in this form in (non-native) React would be like this: <div> <label htmlFor="lastName">Last Name:</label> <input type="text...
When using the Array.prototype.sort method, we can pass a compare function as argument. Then, this function can be used to process array's elements, so the comparison is made using some custom crit...
As this is the first question about Google Apps Script, here is a very brief description: it is a platform that helps people easily get programmatic access to Google apps data like Gmail messages, ...
Context I have started working on an Angular upgrade for a medium-sized project (from v. 10 to v. 15) and this is a rather long activity that is interrupted by other changes that need to be perfor...
I am creating a button that once clicked will change from off to on with react and i am also creating a responsive clock through useEffect. Yet the code still return that useEffect is undefined th...
I wanted to create a simple static website that would use JS to randomly rotate through a quotes.json file I maintain. My JavaScript experience is more limited as it's not what I do at work, so wha...
There may be a better way to manage website's with JavaScript deployments. I added jest to my repo simply to execute tests when I make PRs as part of a GitHub action. This requires a package-lock.j...
Goal Our goal is to create a kind of table, using HTML/CSS/JS, with cells that expand when you click on them. If you click on a header, the whole row or column will expand. This in itself is not ...
I'm trying to do some DOM manipulation in jQuery, but am having issues with creating wrapper elements. For some reason, prepending to the wrapper doesn't work after I call wrap. Code <html>...
I am working on a React Native app using Realm, Atlas Flexible Sync, and MongoDB, and I'm super confused about how subscriptions work. I'm coming from a .NET SQL background, so I'm completely new t...
I tried using query selector but it does not work heres my HTML code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>JS + CSS Clock<...
I am working on a replit https://AppropriateMessyRoutes.ozabramo.repl.co and I am trying to implement https://github.com/VincentGarreau/particles.js as a background but I keeps on pushing every...
How should I deploy my Full Stack Angular Application (MEAN Stack) project on free hosting website? Github I have provided below the github link of the project for the better understanding. Prob...
Highlight.js version: 11.6.0 Node version: v18.12.0 npm version: 8.19.12 When I provide a plugin with the following code to highlightjs (full code is at github): /* Language: BQN Requires: A...
This is a post of mine from Code Review Stack Exchange which did not get an answer yet. I am developing an Angular application that consumes an external REST API. I am using OpenAPI generator (Typ...
I am trying to understand this code: const iframes = iFrameResize( [{options}], [css selector] || [iframe] ); The code can be found in this documentation. Is [{options}] an array of objects an...
The following code pattern reflects this answer. This code contains a for...of loop: for (const child of e.childNodes) { // Do stuff; } Does a for...of loop must contain a variable without...
Credit for User:Meriton for developing the following code (first published here). function replaceIn(e) { if (e.nodeType == Node.TEXT_NODE) { e.nodeValue = e.nodeValue.replaceAll("a", "");...
I misunderstand why the following code outputs -1 in console. x = 42; x = (x == 42) * -1 + (x != 42) * x; -1 Due to Type Coercion, the comparison of x to 42 yields true and is thus transl...
In a dense DOM tree created by a content management system which I didn't create and don't know much about there might be pseudo elements hiding in various places. To ensure that, I want to run so...
Credit for User:Meriton for developing the following code (first published here). function replaceIn(e) { if (e.nodeType == Node.TEXT_NODE) { e.nodeValue = e.nodeValue.replaceAll("a", "");...
Credit for User:Meriton for developing the following code (first published here): function replaceIn(e) { if (e.nodeType == Node.TEXT_NODE) { e.nodeValue = e.nodeValue.replaceAll("a", "");...
If I am not mistaken any DOM "tree" node is actually a "branch", which would be an HTML element or perhaps a CSS pseudo-element, of course. If that's true what are the different node types and esp...
Primarily for learning, I would like to try to delete a specific character (letter or number or special character), wherever it is in a webpage, with vanilla JavaScript. The webpage won't change a...
In MediaWiki 1.36.1 with Skin:Timeless, the following JavaScript code doesn't work. I get in browser console: Your skin is incompatible with VisualEditor. See https://www.mediawiki.org/wiki/Exte...
I was playing around with mapped tuples and came across an interesting case where TypeScript cannot infer the types used: interface Foo<A, B> { (a: A, b: B): any } function test<...
I wish to view the revision-history-webpage of a webpage in MediaWiki without the conventional button to do so (I've disabled that button for aesthetic reasons). Please disable the MediaWiki View ...
The following code (credit for user:hkotsubo) moves the user to another page if Alt+Shift+E are pressed together. window.addEventListener('DOMContentLoaded', () => { let domain = window.loca...
The webpage example.com has an edit webpage (from which one can edit example.com itself). example.com/index.php?title=עמוד_ראשי&action=edit I want that after I click ALT+Shift+E, I would im...
This data tree is comprised of clickable buttons and I want to expose all branches, in a single action, instead of clicking each vertical arrow button anew. I have tried the following code which d...
Using Angular-IMask, I'm programatically updating the field that has IMask. So I'm getting the error: "Element value was changed outside of mask. Syncronize mask using mask.updateValue() to work p...
I wish to display the first and second branches of a link tree with JavaScript. I want to show these branches in a single action, instead of clicking each vertical arrow (link) anew. HTML examp...
Used to work with PhantomJS. Want to upgrade to Puppeteer. Started with some code: "use strict"; const puppeteer = require("puppeteer"); const capture = async () => { let browser; try {...
I was trying to initialize a simple two dimensional array as follows: const arrays = Array(3).fill([]); However, when I tried to push an entry into one of the arrays, it seems like it gets push...
I am interested in finding out all the aspects I need to cover in order to correctly assess if a user has stopped interacting with a web page. So far, I found the following: Idle Detection API -...
I am trying to listen to the event in which the keyboard key containing the Hebrew final-letter ך is pressed. This key stands for both the English letter L and the Hebrew final letter ך. If my op...
Before I publish a new webpage in my website (in the content management system itself), I zoom in from say 100% zooming to 500% zooming and then re-read it, as a nice way to check for typos. The p...
I have an array that I need to clone in Angular / Typescript. That is, any change done on an element from the cloned array should not affect the content of the initial array. How can I achieve thi...
I have an iframe tag to which I didn't set height so it has a default height which is 150px (at least in Google Chrome). As a consequence, the iframe appears partially in such a way that constant ...
I am trying to submit a form with Ajax from a well-configured shared hosting environment. Emails don't arrive to my email client although I have already sent emails without Ajax from this environm...
I need to apply backend behavior (PHP directives in my case) to an HTML <form>. The backend behavior I wish to apply to the form is in this pattern (behavior.php): <?php $name = $_POST...
I try to exactly match a login page in a website, for a user script manager (USM) script, which I run with Tampermonkey. This pattern didn't work: // @match https://example.com/#/login ...
I have added some input to an input field element this way: const inputFiled = document.querySelector("#example"); inputField.value = "X"; I want to fire a change event for that field right af...
In a website I didn't build, I want to put a value in an HTML input field element with JavaScript and to also use it as-putted. I can put it with the browser console this way: document.querySelec...
If I execute in browser console: document.write("Hello"); A new DOM document with the text Hello appears in the same browser window. From MDN documentation: Note: Because document.write() w...
I want to ensure I understand the following code; credit to user:m3g4p0p on Sitepoint, for this code: const walker = document.createTreeWalker( document.body, NodeFilter.SHOW_TEXT ) let...
I want to dye all label asterisks Red with vanilla JavaScript. CSS isn't good for this because it would dye both asterisks and colons (:) instead just the asterisks: .labelWithColonAndAsterisk:af...