There is a selectfield:
<select class="filter"> <option value=1>Name 1</option> <option value=2>Name 2</option> <option value=3>Name 3</option> </select>
I need to select the text of this item when a user selects an item from a selectfield (that is, the user Name 2 chose, I need to get this Name 2). I hung the following handler:
$(document).on('change','.filter', function (e) { e.preventDefault(); var value = $(this).text(); });
However, the problem is that in this case it takes the text not only from the option of the selected item, it in general pushes all the text from the option into all. How can I solve this problem?