hi .. iam trying to add items to an ul element using jquery. the items will be added when a user click on Add new item : here is what i have :
function addFormField() {
var id = document.getElementById("id").value;
if(id<5){
$("#elem ul").append('<li id="listItem_"'+ id +'>Item Added Nr.'+ id +'</li>');
document.getElementById("id").value = id+1;
}
...
<div id="elem">
<ul id="test-list">
</ul>
</div>
<p><a href="#" onClick="addFormField(); return false;">Add New Item</a></p>
but when i submit the form, the ul elements are empty, that means i am getting no array where all the list items the user added are..
how can i get a list of the items added by user when they click on the Add button !?
any help is really appreciated, thanks a lot