1

I have to droppable area with same name, I need input for each to save it then in different places. The problem is its just creating new input after clicking save button but I need to update already existing input and creating new one. You can see sample here I am using this function to create input for each of the boxes. in my work it can be even more than 2. It depends on user's input:

var LISTOBJ = {
    saveList: function() {
        $(".projLeader").each(function() {
            var listCSV = [];
            $(this).find("li").each(function(){
                listCSV.push($(this).text());
            });
            var values = listCSV.join(', ');
            $(".output").append("<input type='text' name='projLeader[]' value='"+values+"' /></br>");
            console.debug(listCSV);
        });
    }
}

1 Answer 1

3

You can try below code, might be help you.

        var LISTOBJ = {
        saveList: function() {
          $(".output").html("");
            $(".projLeader").each(function() {
              var listCSV = [];
              $(this).find("li").each(function(){
                  listCSV.push($(this).text());
              });
              var values = listCSV.join(', ');
              $(".output").append("<input type='text' name='projLeader[]' value='"+values+"' /></br>");
                  console.debug(listCSV);                     

            });
          }
        }
Sign up to request clarification or add additional context in comments.

3 Comments

is it what you looking for or need something else ??
Let me check it inside my system, in fiddle seems like yes. So you just clear output every time before appending values again right?
yes the above code do the same. every time clear all inputbox and add new with new values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.