I have got a problem with executing a submission of dynamically added (by function) with two scripts in HEAD.
My HTML is:
<html>
<head>
<title>Web Page</title>
<script src="js/jquery.min.js"></script>
<script src="js/script.js"></script>
<script src="js/forms.js"></script>
</head>
<body>
<div id="container">
</div>
</body>
</html>
So when I dynamically by function adding a form into and trying to submit the data it doesn't work. All required code for execution the form is in js/forms.js I suppose it doesn't see the dynamic objects.
The form which is being added dynamically looks like (with jQuery code):
$('#container').append("<form class='input-form'><input type='text' id='login' /><input type='password' id='password' /><input type='submit' /></form>");
And the script is:
$('form.input-form').on('click', '#sendbutton', function () {
preventDefault();
var value_login = $("#login").val();
var value_password = $("#password").val();
alert(value_login + value_password);
});
Would anybody suggest how to make it working in jsfiddle? Or what I am doing wrong?
The real example here: http://jsfiddle.net/gu5qnfw1/2/