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 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...
No, I'm not trying to get the full program written completely in C by you guys. I only need some way to implement the functionalities of each function I found confusing. In this challenge in Code ...
I wanted to print to browser console the number of li list items of a given ul list. This didn't work (console output was undefined): console.log(document.querySelectorAll(".example").length); ...
I develop an HTML-CSS-JavaScript-PHP contact form and I have a large HTML file which is very long and very wide (lots of horizontal scrolling due to nesting) and it's hard for me personally to work...
I have a variable defined using const keyword. function Text() { const variable = "Hello!"; } console.log(variable); When I try to access this variable, I get: Uncaught ReferenceError...
const body = document.body; const light = evt => { body.setAttribute('data-theme', 'light'); localStorage.setItem("theme", "light"); console.log("light"); } const dark = ...
While learning JavaScript, I started to see =, == and === operators. What's the difference between them?
While learning JavaScript, I started to see sometimes the <script> is placed in the <head> and sometimes it is placed in the <body>, What's difference between placing the <scri...
I have developed an Atom package which calls SyncTeX (a utility for reverse lookup for LaTeX), and then opens in Atom the file specified in the SyncTeX response. I'm developing on Linux, but now a ...
Let I have a button <button type="button" onclick = "myfunction()" class="collapsible">Expand content</button> And, I have a JS function. function collapse() { var coll = docu...
I consider to create a multi page contact form in which there is one backend page but about 5 front-end pages (stage 1-5). Pages 1-4 are input pages and page 5 is for a submit button and a success ...
I wrote this HTML sanitizer for use in web scraping. The idea is to safely copy content from a site but apply my own style-sheet and remove any unsafe elements. This whitelist approach seems very d...
I would like to maintain a log that is available to several modules in my Angular 8 system. So I created the following service: @Injectable({ providedIn: 'root' }) export class LogService { ...
Our web site has a widget that displays some date-based information that we retrieve from some JSON-formatted data (one object per date). We get the current date from the environment, possibly adj...
I have a simple HTML-PHP-CSS contact form (no JavaScript) with an input type="url" field. Currently in 30/03/2021, the default behavior of input type="url" (by W3C design I guess) is to obligate t...
I consider to make my website's contact form totally javascriptless (only HTML-PHP-CSS --- no JavaScript at all). No modals or alerts No prevent default No AJAX/AJAX/XHR/JHR No form disappear...
I am currently making an esoteric language which requires a theoretically infinite canvas. Basically, it should be able to resize and fit the contents of the drawing in and outside it's existing bo...
I am currently making a userscript to interpret the APL programming language in a Stackexchange chat window. This is the code I have come up with: // ==UserScript== // @name APL chat // @ver...
I am currently dealing with an Angular application that is being deployed using an CI orchestrator and Jenkins. Jenkins job is configured to do the following (relevant steps only): fetch source...
I recently encountered a strange situation in javascript; if I have: let obj = { a: function() { return (this === obj) ? this.b : 'bye'; }, b: 'hello' }; I can call obj.a with this bound...
Tldr; I don't need to parse HTML, but I need to check if user submitted input conforms to a very strict subset of HTML. Can regex be a suitable tool for this? Details I have a frontend sanitiser th...
I am writing a spoof of the fs module; the actual storage mechanism is not the the filesystem but rather a database. Overall, however, the api will function exactly like fs. So far my code is compa...
I'm developing the design framework for a certain Q&A site. We are currently using an external dependency for the tag selector on the post editor, but it has some disadvantages (not fitting int...
- ← Previous
- 1
- 2
- Next →