I am using 2 buttons to open two separate php pages but I would like to use one function to trigger both the buttons. The AJAX function that gets triggered should check which button was pressed and then open the php page associated with it. Such that “Export Page 1” should open Page 1.php and R…
Tag: javascript
Returning the default value for the key that cannot be found in the javascript object
When a key that is not in the object is called, it returns undefined. I want to return a string that I specify instead of undefined. for example I want console.log (res) to return “key not found”, not undefined. Is this possible? Answer You could take the Nullish coalescing operator ??, which repe…
How can I delete a message after sending it?
I have a code that sends a message when a member joins the guild and I want to shortly delete it afterwards. My code: I tried embed.delete or just the classic msg.delete but it doesn’t work as I can/don’t know how to define “msg” as the last msg the bot has sent. Answer kanal.send(embe…
Angular-6 show and hide drop-down select option not showing proper data
I have 2 types of drop-down based on the select value column drop-down will show. (one for to show database data, another one for to show desktop data.) https://stackblitz.com/edit/angular-ivy-3n238j?file=src%2Fapp%2Fapp.component.html app.componet.html My issue is below In 1st row if I select desktop it will…
How to add array to includes() javascript
Im using composedPath for detect click outer of elements, but if elements more then 1 i need to add them all in if(). Maybe in js have another way? Im trying .includes(document.querySelectorAll(“.js-open-user”)); But thats not work. Answer You can convert a NodeList to an array by using Array.prot…
Vuetify- How to make a link in the textarea clickable?
I have a simple v-textarea Is there a way to detect that a link has been inserted and make it change color and be clickable? Such as this https://stackoverflow.com/. Answer You cannot make clickable links inside textareas (v-textarea is just a wrapper around a native one). They are for plain text only. As a p…
Slowmode command
When I type ;sm, my bot responds with: “You need to specify a time in seconds” <– Thats okay. But when I type ;sm [time], it still responds with: “You need to specify a time in seconds.”, but it should set the rate limit and tell me that “Slowmode is now [time]s”. …
React Js – Styling innerHTML on component – Not working – Parent styling is overriding child styling
I have two react components. List container List The list needs to be inside the list container. Like so: The content of both components renders. However the styling of the child is overridden by the parents styling. (In this case, the background color) This is the full code: I think it may be a similar thing…
random number that always makes a total of 100 into array
Hi i am trying to create an array that always has a total of 100 based on random numbers. I get it to work when there is 2 or 3 rows but i can’t get it to work if there are more as 4. Meaning i need to change the middle section. Here is simple code i made: (the length
Vuex 4, State is empty in component
I am trying to access subjects store state using this.$store.state.subjects inside my home component however it comes up as an empty array. Using console.log the only place I am able to see the state.subjects populated is if its in the mutation function. Anywhere else the console.log is empty. It seems to me …