how can i bring All fields are required! Error Alert down to input box like show error that username filed required down on username input filed same to password filed down on inputbox Answer An alert always appears at the top of the page. If you want some kind of indication below your input fields, you could…
navigator.share file not working on iOS 14 Safari
I’m trying to add to my webpage an option to share image and video using Web Share API. When testing it, I’m having the following problem: on Android + Chrome, it works sharing video and images, but when I execute the same code on iOS 14.4 Safari (running on iPhone 6s) I only get the text and URL …
when I learned about microtask and Promise , I came across a behavior I don’t understand
I didn’t return something in then() callback, In my opinion the output should be 1 5 7 2 6 3 4,but the result is 1 2 5 3 6 7 4, who can tell me why Answer Alright, this will be very verbose. Contrary to others, i’ll claim, that the execution order for the console.log calls is completely determinis…
How to change production build static folder path in a React project?
I have a React project on which I ran npm run build and it made a production build for me. The problem is that it gives me the following stylesheet injected into the index.html As you can see, the path set is ./static/js/ But I want the path to be set to ./static/dashboard/js/5.a4bfdba9.chunk.js I can’t…
How to update the cached files in my service worker every 30 minutes?
I have this service worker: In “stock_items_balance.php” i fetch data from my DB. So in every 30 minutes i would like to update my cached pages and reload the window. So first i have a script that checks for internet connection. If true, i want to clean/update the cache and reload the page. How ca…
Eslint – ‘observer’ was used before it was defined?
I am trying to solve my order issue I am getting an Eslint error where “observer” was used before it was defined. But when I replace the observer above the onInterSection function I get onIntersection was used before it was defined. Answer You could try and write it like this:
How to run a JavaScript solution from HackerRank on Idea / WebStorm IDE?
Say you want to run / debug a HackerRank solution locally on your WebStorm / IntelliJ Idea IDE for for macOS before submitting it. What are the needed steps, considering node.js is already installed in your machine? Sample Hello.js file as below: Answer On macOS Mojave the steps are: On Preferences > Keyma…
How to prevent user from entering negative number in react?
I want to restrict users from entering negative values. I am using min = “0”. With this i can restrict users from decrementing to 0, i.e, users can only decrement value till 0. But they are able to type “-“. How to prevent in react js. https://codesandbox.io/s/react-input-example-forke…
JavaScript: return all contiguous subarrays whose sum equals K
This is a variant of this leetcode question, but instead of returning the count, we want to return the actual contiguous sub arrays. For example, if num = [1,2,4,7] k=7 the returned value should be [[1,2,4],[7]] . I used a hashmap to store the cumulative sum up to all the indices possible along with the numbe…
How to download a vue file as pdf file in vuejs?
I have a vue as below which I want to download as PDF when I click on a button in main_component. Please help me find a way around to do so. download.vue main_file.vue Answer You can use the Javascript window.print document method and import your download.vue component into main_file.vue component and then pa…