JQuery - My tags box doesn't work because i'm using the clone() event -


i created little script, when write on textbox , click space, words written, goes hidden area, , separated, appear tags.

google use script gmail, when write contacts, , youtube too, when write video tags.

so, o created script, , working well.

but want create new script, clones form, every moment click @ link, new form equal last, appears.

i used "clone()" that, working, cant call hidden form tags, resuming, "clone()" cant read tags.

i'm new @ jquery, so, want know how can make event clone() read tags.

here jquery code tags:

   $('#tags').keypress(function(e) { //check if space clicked, , create new tag        if(e.which == 32) {            var tx = $('#tags').val();            if (tx) {             $(this).val('').parent().before('<li class="tags"><span><input type="hidden" value="'+tx+'" name="tags[]" />'+tx+'</span><a style="cursor:pointer;" id="close">[x]</a></li>');                closer();            }        }    }); 

and html input box

  <label>tags<a class="required_field">*</a></label>       <div id="wrapbox">          <div id="box">             <span id="checktags"></span>             <input type="text" class="to-be-clicked" id="tags" class="tagstype" maxlength="230">          </div>       </div> 

and i'm using code clone form

     $(".add").click(function(){     $("#job").clone().appendto("body");   }); }); 

if using default clone() method pass false argument in clone(false),

you can pass boolean value clone parameter, boolean indicating whether event handlers should copied along elements.

$("#job").clone(true).appendto("body"); 

clone() method documentation

hope you!


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -