6
rated 0 times
[
7]
[
1]
/ answers: 1 / hits: 147073
/ 12 Years ago, wed, july 18, 2012, 12:00:00
I have used this jquery validation plugin for the following form.
<script src=http://code.jquery.com/jquery-latest.js></script>
<script type=text/javascript src=http://jzaefferer.github.com/jquery-validation/jquery.validate.js></script>
<script>
$(document).ready(function(){
$(#commentForm).validate();
});
function addInput() {
var obj = document.getElementById(list).cloneNode(true);
document.getElementById('parent').appendChild(obj);
}
</script>
<form id=commentForm method=get action=>
<p id=parent>
<input id=list class=required />
</p>
<input class=submit type=submit value=Submit/>
<input type=button value=add onClick=addInput() />
</form>
When the add button is clicked a new input is dynamically added. However when the form is submitted only the first input field is validated. How can i validate dynamically added inputs?
Thank you...
More From » jquery