Posts tagged javascript
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...
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...
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...
I want to change the font-family of all elements in a document with JavaScript. I have tried this: document.querySelectorAll("body").forEach( (e)=>{ e.style.fontFamily = "arial"; }); ...
I have a JavaScript file in GitHub which I typically run by copy-pasting all its data into different user script managers (USMs) on different web browsers. I need to start executing that remote fi...
I understand that innerHTML does all the following actions: It makes the element we work on (or even the entire DOM tree that we work on if that element is <body>) to be copy-pasted into a...
I define a software event as any state of a program to which we can probably respond. In JavaScript, how does event delegation differs from more simple and probably more common event handling patt...
How can I monitor an Angular frontend with Prometheus? I was able to create metrics for my Node.js API using the express-prometheus module. But I can't find any Angular/Prometheus integration. Basi...
I have a .html file containing only the following data, and I keep that file on top of my website's directory. <link rel="stylesheet" href="./css/mobile_general_structure.css"></link> ...
How to make the placeholder so that it goes to the top of the border line on click? For example, when you go to Gmail and click on the input field, the placeholder text goes up and arranges itself...
It's possible to use Angular 8 http.get to get a page from the frontend itself ? My local frontend url: https://192.168.0.177:4200/ I tried in a service: test(): Observable<string> { ret...
I made carousel image slider by following tutorials. To slide images , I made the below function. const moveToSlide = (track, currentSlide, targetSlide) => { track.style.transform = 'translat...