Skip to content
Advertisement

How to extract an id from id field in html to send it via axios in Vue?

I’ve no idea how to get the id of element in order to send it. I use Vue 2.

** offers array i get from the API, so it is just an example.

I need getting id dynamically in order to send a comment for the exact offer.

Maybe it is the wrong way to do it, but it would be great if it worked this way

HTML:

JavaScript

JS:

JavaScript

Advertisement

Answer

Great thanks to @don_aman!

The final code will look like:

JavaScript

JS:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement