How to create JOI validation with Node js if string contains empty space at start or end send error example : if input is name = “test123” //valid name = “test(space)” or “(space)test” // invalid Answer You can use below regex to validate the your cases
Tag: javascript
Why does my content disappear when using scroll
I have a list of servers in a scroll container name servers and the top of the list is hidden under the navbar: HTML: CSS: This list starts empty. divs are added to this list of servers when you use the site. When too many divs are added, scrolling starts. But the problem is that the top objects are hidden
Finding position of dom node in the document source
Context I’m building a set of ‘extractor’ functions whose purpose is to extract what looks like components from a page (using jsdom and nodejs). The final result should be these ‘component’ objects ordered by where they originally appeared in the page. Problem The last part of th…
Why are showing blank page in reactjs?
I am using class and constructor in react-js but this program does not error is thrown in console. show a message only blank. what is wrong? Answer You need to pass it as <Component />. And Still doesn’t work then add your index.html, there might be the issue then. PS: If you want to render only e…
Why is my card overlapping the fixed nav when I hover it?
I have a problem when I hover my article with class=”card” name inside my div class=”container”, it looks like the article overlaps the nav. How do I fix this without removing my transform scale in .card:hover? I want to make it without overlapping with the nav when I hover over it. If…
Rest operator with Variable reference
I can’t understand why these two codes don’t work the same: This one works as expected and returns the sum of …array (10) But when I try to do the same by calling the function with a variable reference: The output is 4. Why the function works differently in the two situations? Answer Parenth…
Another stopwatch using JS?
The code is creating a responsive page. But every time I press stop and then start again the countdown speeds up. Seconds pass like milliseconds and mins pass like seconds after about 10 or so stops and starts. What might be the issue here? P.S. I haven’t written code for the reset button. Answer You ha…
How to make active button color in jquery?
This is the code I use in Elementor to make a custom tab section. All thing is working but my active tab does not show any active color. I want to make tab active color like the navigation menu active color. Answer you can create class “active-button” and add to your element when get actives. } an…
How to replace a loop for a loop?
I have a grid made with a preset value that I’d like to have a function that replaces it with a grid who’s cells are generated with dynamic values gotten from a prompt input. The code for both grids work independently if I were to remove the other’s code, but for whatever reason I can’…
Using regex to capture a value in a text line
I have a text line and I need capture the value “Keyword” key. In this sample the value is “ConquestImageDate”. With my code below I can capture the value as ConquestImageDate”. But it has a ‘”‘ on the end. I know I can use a replace to get rid off it. But, I´d …