I have a form dynamically created using Jquery and i am trying to validate the form but every time i try to get the input field value it says "undefined" , My code to get value
var username = $('#username').val();
console.log(username);
Edited : Below function will add the form field to the div.modal
function AddUserDialog(){
var temp = '<input type="text" name="username" id="username" />';
$('.modal').html(temp);
}
Thanks