Skip to content Skip to sidebar Skip to footer

Get Selected Value From Dynamic Dropdown In Table

I have a button that adds a row to a table so that data can be inserted. One of the tags populates a dropdown menu. I need to get the value from that dropdown to post in

Solution 1:

The .val() method is used to get the value of an element.

Also note that @Kaka Sarmah is correct. Even this will not work because you're creating multiple elements with the same ID. IDs must be unique. Try giving it a class instead.

html += '<tdcontenteditableclass="positionID"><selectclass="positionList"><option></option></select>';

Then in your javascript you can try to locate it using that class. Something like:

var position_ID = $(this).parents('tr').find('.positionList').val();

Post a Comment for "Get Selected Value From Dynamic Dropdown In Table"