Get selected value in datalist using jQuery

后端 未结 9 1899
终归单人心
终归单人心 2020-12-06 11:46

Very simple and straight forward. I pre-populated a HTML datalist with values, on the form when I want select a value and insert it into SQLite database. This is my example

9条回答
  •  无人及你
    2020-12-06 12:04

    The easy way is to get the name of datalist using it's name attribute and then use val() function to see the value selected

    $('[name="TypeList"]').val();
    

    Check the working example https://jsfiddle.net/ch9uwvod/8/

提交回复
热议问题