I’m using a template to get data of a json file, I use “v-for” to print all data, for example: But I need use functions, year() to modificate this information and return and result, for example: The value {{ item.date }} print “2021-01-20” but I hope print “2021” usin…
Tag: javascript
ECONNREFUSED when dispatch action in nuxtServerInit
I am converting my Nuxt application to SSR – because I want to use nuxtServerInit and asyncData. These are the steps I have taken to convert it. Remove ssr: false from nuxt.config.js Dispatch actions to initialize store’s state in nuxtServerInit inside store/index.js Now my nuxt.config.js looks li…
VueJS – call function in external JS file directly from Template
Let’s say that in a VueJS project, I have a HelloWorld.js file like this: And it’s used from HelloWorld.vue like this: My agony comes from having to ‘duplicate’ the addNumbers function in the methods section of the HelloWorld component. Is there a simple way to make the external addNum…
javascript execution failing in java with XPathResult undefined
I’m trying to execute the javascript function with java, and I’m getting an error message that it is not able to find some of the classes. can someone please help me to clear this issue? My Java class Exception please let me know if data required from my side. Answer The problem with your code is,…
image is not show in img tag when upload it again
I use the following method to upload an image and display it in an img tag. Another button is used to delete that image. Upload and delete are working well, but the problem is when I want to upload an image again after it has been deleted. It does not be show up and when I open the console it
How can I stop these ‘s using space when I hide the labels?
I have 5 radio buttons, every one, when it is pressed, calls the function that hides/shows the input labels that I need. I used document.getElementById(“id”).style.display=”none”; and it works, but it still takes space. I want the inputs of the form to fill the space above them when th…
JavaScript only changes text of first iteration with thymeleaf
I hope you are all well. I have a school assignment, and I want to dynamically be able to change the name of a ‘project’. This assignment is about projects. The way I’ve done it right now works with the first ‘project’ from a list of ‘projects’ iterated through with t…
Check for non null array during filtering an object
Trying to filter the object to return only non null values. Below is excerpt from my code. How do I check for non null values in the array job in this case? Could anyone please help? I was expecting the result to be Answer First map the array in the entries to keep only truthy values, then filter the entries
Append array of object values if index is the same index of a div list
I need help: I have one object with multiple array inside; i need to cycle all my array values and then append this values inside my HTML div list (with the same class). object[0] with div[0]; object[1] with div[1] ecc… This is an example: But this method return to me with a wrong result like this: Firs…
How to select values from li elements in Cheerio/jQuery?
I want to extract the values from the product__sizes-size-1 classes and transform them into an array. I have tried to use a .map() function to try and populate an array but it appears empty. To make it clear I want to have the array populated like [6,7,8,9.5] etc… Answer Your approach is correct, you ju…