javascript - A .clone is not working properly nor is it returning array of names -


my code supposed have 3 input boxes , when click "add set", should clone 3 input boxes. when click "get company names" should return array of company names, being of values boxes.

as stands, "add set" not work , not understand why. problem that, "get company names" returns object rather value .val suggest.

`alert($("#workexperiencebox").find("input[id=companyname1]").val(""));`  

also, in fiddle, see code using duplicate boxes. extraworkepxerience div , workexperience first div inside of div.

var workexperience = $("#workexperiencebox").clone();     $("#extraworkexperience").html(workexperience); 

the fiddle at. please help!

fiddle: https://jsfiddle.net/tubbstravis/tmakdo1x/3/

id has unique, had made id's have used classes. other problem using html() instead of append(), result make entire html content of container replaced.

var getnames = function(num) {   alert($(".workexperiencebox").find(".companyname1").map(function() {     return this.value;   }).get()); }  var addworkplace = function() {   var workexperience = $(".workexperiencebox").clone();   $("#extraworkexperience").append(workexperience); } 

demo


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

c# - Json.Net Serialize String from URI -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -