I searched a lot on stackoverflow and other sites and got a lot of solutions, but mine didn't resolve anything. That is why I am posting this. I have a password field on my web page that was created dynamically by click.And link. I want to get the value entered in this password field into a variable when it loses focus. To do this, I created a jQuery function similar to this one.
$('#parentdiv').on('focusout', '#passwordfield', function() { var pass1 = $('#passwordfield').val(); alert(pass1); alert("Hello"); });
Here the first warning command will be displayed in nothing, but the second warning will appear with "Hello". This means that when the password field loses focus, this function is executed without any problems, but the problem is that it does not receive the value of the password field.
Please help me solve this problem.
EDIT
This is my html
<input type="password" size=20 id="passwordfield" />
source share