Skip to content
Advertisement

How to get value of appended input div on appended button click?

I have simple HTML like this;

JavaScript

I have a plus button, using which I am appending the same fields below. Now I want to retrieve the respective selected language id with the click of the respective upload button. But every time it returns me the value of first select field.

Here is what I have tried;

JavaScript

Can anyone let me know how to get respective selected language id on respective button click?

Advertisement

Answer

You need to use prev function and change select[id=xxxx] by select#language

https://api.jquery.com/prev/

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