javascript - Cloning a div with multiple input is not working -


by default multiple input appended #captureavail_more below this:

$(function() { $("#captureavail_more").append("<input type='text' name='avail[]' value='sun-1'>"); $("#captureavail_more").append("<input type='text' name='avail[]' value='sun-2'>"); $("#captureavail_more").append("<input type='text' name='avail[]' value='sun-3'>");  $("#captureavail_more").append("<input type='text' name='avail[]' value='sat-1'>"); $("#captureavail_more").append("<input type='text' name='avail[]' value='sat-2'>"); $("#captureavail_more").append("<input type='text' name='avail[]' value='sat-3'>");  } );    


above append inputs this,

<section id="more-popup" class="mfp-hide white-popup">     //append `input[type=text]` here     <div id="captureavail_more" class="clone_more">     <input type='text' name='avail[]' value='sun-1'>     <input type='text' name='avail[]' value='sun-2'>     <input type='text' name='avail[]' value='sun-3'>      <input type='text' name='avail[]' value='sat-1'>     <input type='text' name='avail[]' value='sat-2'>     <input type='text' name='avail[]' value='sat-3'>     </div>      <input type="button" value="ok" id="ok" onclick="cloneavail()"/> </section> 


when ok button clicked, need clone input[type=text] of class ('clone_more') values div#captureavail2, not cloning @ all. going wrong here. below code cloning.

//html inputs .clone_more need appended here

 <div id="captureavail2">     </div> 


function clone

function cloneavail() {     alert("hi");     $(".clone_more input[type=text]").clone(true, true).append("#captureavail2"); } 


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -