D
D
Dmitry Kuzmenko2017-12-10 16:13:49
C++ / C#
Dmitry Kuzmenko, 2017-12-10 16:13:49

Why doesn't the value in input change as you type?

Good day, please tell me what could be the problem, when I enter the input, I can not get the value.
I output to the console there something like this
5a2d3295850ba405849923.png
id is unique, this is 100% I checked, it was not me who made it up.
The first time is that I can not get value
Maybe someone faced such a problem?
The site itself can be viewed at nakrutka.bz
Thank you all in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2017-12-10
@kuzmenkodiman

There are two elements on the page with the same id . Your script picks up and listens to the first one, and the user interacts with the second one, which your script doesn't listen to. Apparently, the peculiarities of the work of the vendor library. Add a class, for example f1 and fetch from it, and get the value from e.currentTarget :

$('.f1').on('change', function(e) => {
 var value = $(e.currentTarget).val();
})

This code, executed in the browser console on your site, works great:
$(document).find('.form-element').on('change', e => console.log($(e.currentTarget).val()));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question