Skip to content

Tag: javascript

Change image src to a local image using javascript?

First time ever touching javascript here, so bear with me. My file structure looks like so: I want to change the image in my HTML using js. Here’s the relevant HTML code: And then the corresponding js code in assignment_3.js: Obviously, something is amiss here, as the browser doesn’t seem to recog…

socket.io broadcast in a room

I am trying to use socket.io to broadcast only to users of a specific room (in another word, to send to all users in that room except me, the sender). So far, I have tried: None of them work unfortunately. Answer io.of(“/”).to(room_temp).emit(‘transcription’, data); would submit to eve…

Window.location not working in Javascript

So I’m new to JS, and I wanna redirect the user to another page… My code: I know this is not a secure way to auth, but relax it’s just a portfolio project Answer You should append the ‘//’ after window.location.protocol which mentioned by @Vasan. Using ES6 template strings would …

Using Ag-grid with object of nested objects

I am trying to use ag-grid with an api that gives the following code And my ag-grid is set up in the following way So far that is giving me an error. I am not understanding why, because the code is working fine when I use a different api. The other api returns the following And my working grid is

Ternary conditions to find expmod?

I am reading SICP in JS about a non-terminating example of ternary conditions: It explains that: This would make the function not just inefficient, but actually non-terminating! The problem is that the constant declaration appears outside the conditional expression, which means that it is executed even when t…

Javascript for loop only giving one output

I’ve been toying with this for far too long… I have no clue why that for loop at the end only sends one GET request. Please, spare me my sanity… I just don’t get it. The array “urls” contains the information I need, and the variable “sendstr” works perfectly wel…

Insert a image in on column in my table in quasar

How can I insert an image on one row of my table? I have tried to put v-if in my loop through the columns but I cannot get it right. I am pretty new to quasar so I might confuse things. My idea was to use the v-if for checking if the column name is ‘Image’ insert an image. And