Get selected value in datalist using jQuery

后端 未结 9 1901
终归单人心
终归单人心 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 11:58

    Have a selector to select the input element. Mention the event after which you want the values to be moved. Get the value by using .val().

    Example:

    $("input[name=TypeList]").focusout(function(){
        alert($(this).val());
    });
    

    Hope this is what you are looking for jsFiddle

提交回复
热议问题