Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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

8 child tags

Use for questions regarding programming in ECMAScript (JavaScript/JS) and its various implementations. This should be accompanied by the specific framework / dialect used (e.g. jquery, node.js, typescript).

This tag doesn't have a detailed wiki yet.

77%
+5 −0
Q&A How to deeply clone an array in Angular / TypeScript?

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...

2 answers  ·  posted 2y ago by Alexei‭  ·  last activity 2y ago by hkotsubo‭

50%
+1 −1
Q&A iframe tag is vertically scrollable although I would expect it to vertically stretch 100%

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 ...

1 answer  ·  posted 2y ago by deleted user  ·  last activity 2y ago by deleted user

Question javascript css iframe
55%
+3 −2
Q&A Uncaught TypeError: Failed to construct 'FormData' [closed]

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...

1 answer  ·  posted 2y ago by deleted user  ·  closed 2y ago by Alexei‭

37%
+1 −3
Q&A How to submit form data with Ajax?

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...

1 answer  ·  posted 2y ago by deleted user  ·  last activity 2y ago by r~~‭

71%
+3 −0
Q&A Hash sign as a path component in a user script's @match command prevents the script from running

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 ...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

50%
+1 −1
Q&A How to fire the change event for an input field?

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...

2 answers  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

28%
+0 −3
Q&A Why would a form value inserted with value property won't be effective? [closed]

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...

1 answer  ·  posted 2y ago by deleted user  ·  closed 2y ago by Alexei‭

71%
+3 −0
Q&A document.open() and the DOM tree of the loaded (closed) browser window on which it works

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...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

Question javascript dom
66%
+2 −0
Q&A Understanding createTreeWalker method in the context of replacing strings (or parts of them)

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...

1 answer  ·  posted 2y ago by deleted user  ·  last activity 2y ago by hkotsubo‭

66%
+4 −1
Q&A Dye all label asterisks Red with vanilla JavaScript

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...

2 answers  ·  posted 3y ago by deleted user  ·  edited 2y ago by deleted user

57%
+2 −1
Q&A Change font-family with JavaScript

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"; }); ...

2 answers  ·  posted 2y ago by deleted user  ·  edited 2y ago by deleted user

Question javascript
50%
+3 −3
Q&A How to run a remote JavaScript file from GitHub?

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...

2 answers  ·  posted 2y ago by deleted user  ·  last activity 2y ago by chovy‭

Question javascript github
36%
+2 −5
Q&A What problem does innerHTML solves?

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...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by deleted user

Question javascript
36%
+2 −5
Q&A What is the main difference between event delegation to other event handling patterns in JavaScript?

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...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

60%
+1 −0
Q&A How can I export metrics from Angular frontend to be read with Prometheus ?

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...

0 answers  ·  posted 2y ago by nelson777‭  ·  edited 2y ago by Peter Mortensen‭

57%
+2 −1
Q&A How to append HTML to the DOM with JavaScript?

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> ...

2 answers  ·  posted 2y ago by deleted user  ·  last activity 2y ago by Ullallulloo‭

Question javascript html dom
71%
+3 −0
Q&A How to make the text box such that its placeholder goes up and arranges itself in the centre of the border upon clicking?

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...

1 answer  ·  posted 2y ago by nobodyImportant‭  ·  edited 2y ago by hkotsubo‭

Question javascript html css
60%
+1 −0
Q&A Using http.get to get page from frontend

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...

1 answer  ·  posted 2y ago by nelson777‭  ·  last activity 2y ago by Derek Elkins‭

71%
+3 −0
Q&A setting of translateX for carousel image slider

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...

0 answers  ·  posted 2y ago by aya2222‭  ·  edited 2y ago by aya2222‭

42%
+1 −2
Q&A How do I filter an array in C?

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 ...

2 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Derek Elkins‭

Question c javascript array
57%
+2 −1
Q&A Function.prototype.call()

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); ...

1 answer  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

57%
+2 −1
Q&A How to include HTML files in another HTML file with vanilla Javascript?

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...

0 answers  ·  posted 2y ago by deleted user  ·  edited 2y ago by Alexei‭

60%
+1 −0
Q&A Uncaught ReferenceError: variable is not defined

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...

1 answer  ·  posted 2y ago by Kevin M. Mansour‭  ·  edited 2y ago by Alexei‭

37%
+1 −3
Q&A theme always not changing [closed]

const body = document.body; const light = evt => { body.setAttribute('data-theme', 'light'); localStorage.setItem("theme", "light"); console.log("light"); } const dark = ...

0 answers  ·  posted 2y ago by Anonymous‭  ·  closed 2y ago by Alexei‭

Question javascript html theme
77%
+5 −0
Q&A What's the difference between =, == and === operators in JavaScript?

While learning JavaScript, I started to see =, == and === operators. What's the difference between them?

3 answers  ·  posted 2y ago by Kevin M. Mansour‭  ·  last activity 2y ago by hkotsubo‭

81%
+7 −0
Q&A What's the difference between placing <script> in the <head> and placing in the <body>?

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...

1 answer  ·  posted 3y ago by Kevin M. Mansour‭  ·  last activity 3y ago by Kevin M. Mansour‭

83%
+8 −0
Q&A Path separator for Atom / JavaScript on Windows

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 ...

0 answers  ·  posted 3y ago by A. Donda‭  ·  last activity 3y ago by Kevin M. Mansour‭

33%
+1 −4
Q&A How to call a function from ruby-on-rails (HTML)?

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...

1 answer  ·  posted 3y ago by deleted user  ·  last activity 3y ago by Kevin M. Mansour‭

28%
+0 −3
Q&A Storing input from different frontend webpages of a multi page contact form

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 ...

1 answer  ·  posted 3y ago by deleted user  ·  last activity 3y ago by elgonzo‭

81%
+7 −0
Code Reviews Is this HTML sanitizer safe?

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...

1 answer  ·  posted 3y ago by mousetail‭  ·  edited 3y ago by Peter Taylor‭

71%
+3 −0
Q&A How to retain a service's data between components in Angular 8 ?

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 { ...

1 answer  ·  posted 3y ago by nelson777‭  ·  last activity 3y ago by nelson777‭

81%
+7 −0
Q&A Why is this client code getting the wrong date for a few hours a day?

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...

2 answers  ·  posted 3y ago by Monica Cellio‭  ·  last activity 3y ago by hkotsubo‭

Question javascript datetime
57%
+2 −1
Q&A Not obligating http:// or https:// in a url field of a contact form

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...

1 answer  ·  posted 3y ago by deleted user  ·  last activity 3y ago by Alexei‭

Question php javascript html
57%
+2 −1
Q&A Are JavaScriptless forms accessible?

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...

1 answer  ·  posted 3y ago by deleted user  ·  last activity 3y ago by Alexei‭

75%
+4 −0
Q&A Resize HTML canvas with respect to inner content

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...

0 answers  ·  posted 3y ago by Razetime‭

66%
+2 −0
Q&A Tampermonkey userscript prevents pages from loading

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...

1 answer  ·  posted 3y ago by Razetime‭  ·  last activity 3y ago by Razetime‭

60%
+1 −0
Q&A Is it necessary for a build server to remove node_modules before an AOT build?

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...

2 answers  ·  posted 3y ago by Alexei‭  ·  last activity 3y ago by Derek Elkins‭

81%
+7 −0
Q&A Function call; `this` gets bound to unexpected value

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...

2 answers  ·  posted 3y ago by Gershy‭  ·  last activity 3y ago by Alexei‭

86%
+11 −0
Q&A Can regex be used to check if input conforms to a very strict subset of HTML?

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...

4 answers  ·  posted 3y ago by jla‭  ·  last activity 3y ago by Stephen C‭

Question javascript regex html
66%
+2 −0
Q&A Nodejs wrap async function in synchronous function

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...

1 answer  ·  posted 3y ago by Gershy‭  ·  last activity 3y ago by Moshi‭

60%
+1 −0
Q&A Access TypeScript class outside bundled code

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...

1 answer  ·  posted 3y ago by luap42‭  ·  last activity 3y ago by ArtOfCode‭