can't validate generated form
Hi,
when I generate a new <form></form>, I do not succes to validatte it.
Please could you help me to find my mistakes ?
here is a light example wich reproduce my problem.
- <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml" lang="fr-FR"><head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" language="javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
jQuery("form").submit(function() {
alert( "Form submitted" );
return false;
});
});
function addForm() {
var addformhtml = '';
addformhtml = addformhtml + '<form id="id_2" name="2" action="">\n';
addformhtml = addformhtml + ' <input type="text" name="addtext2"/>\n';
addformhtml = addformhtml + ' <input type="submit" style="display:none"/>\n';
addformhtml = addformhtml + '</form>\n\n';
$('#addform').before( addformhtml );
}
-->
</script>
</head><body>
<form id="id_1" name="1" action="">
<input type="text" name="addtext"/>
<input type="submit" style="display:none"/>
</form>
<div id="addform" onclick="addForm();" style="text-decoration:underline;"> Add a form </div>
</body>
</html>
Thanx to help me understand what is wrong.