title: how to copy/clone div and it's javascript functions
body: <p>i have this code that repeats div "clone" and retrieve data by ajax from a php file</p>
  
  <p>how can i make the repeated input retrieve data too not the first input only</p>
  
  <pre><code>&lt;div class="input" id="itemRows"&gt;
  
                       &lt;div class="clone"&gt;
                       &lt;?php $x = 1; ?&gt;
                           &lt;style&gt;
                           .txtHint1 {
                               width:95%;
                               padding:10px 6px;
                               border-bottom:solid 3px #06C;
                               background-color:#f1f1f1;
                               margin-right:5px;
                           }
                           &lt;/style&gt;
                        &lt;script&gt;
                          function &lt;?php echo 'showUser'.$x;?&gt;(str)
                          {
                          if (str=="")
                            {
                            document.getElementById("&lt;?php echo 'txtHint'.$x;?&gt;").innerHTML="";
                            return;
                            } 
                          if (window.XMLHttpRequest)
                            {// code for IE7+, Firefox, Chrome, Opera, Safari
                            xmlhttp=new XMLHttpRequest();
                            }
                          else
                            {// code for IE6, IE5
                            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                            }
                          xmlhttp.onreadystatechange=function()
                            {
                            if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
                              {
                              document.getElementById("&lt;?php echo 'txtHint'.$x;?&gt;").innerHTML=xmlhttp.responseText;
                              }
                            }
                          xmlhttp.open("GET","searchuser/getuser.php?clientmergedid="+str,true);
                          xmlhttp.send();
                          }
                        &lt;/script&gt;
                           &lt;input onchange="&lt;?php echo 'showUser'.$x;?&gt;(this.value)" type="text" class="clientphone" placeholder="رقم العميل" name="clientmergedid[]" /&gt;
                          &lt;input type="text" class="clientdes" placeholder="صفة العميل" name="clientmergeddes[]" /&gt;
                          &lt;div class="clearfloat"&gt;&lt;/div&gt;
                          &lt;div id="&lt;?php echo 'txtHint'.$x;?&gt;" class="&lt;?php echo 'txtHint'.$x; $x++;?&gt;"&gt;بيانات العميل&lt;/div&gt;
                          &lt;div class="clearfloat"&gt;&lt;/div&gt;
                       &lt;/div&gt;
                      &lt;a href="#" class="add clientadd" rel=".clone"&gt;إضافة المزيد&lt;/a&gt;
                      &lt;script type="text/javascript"&gt;
                      $(function(){
                        var removeLink = ' &lt;a class="remove" href="#" onclick="$(this).parent().slideUp(function(){ $(this).remove() }); return false"&gt;إزالة&lt;/a&gt;';
                      $('a.add').relCopy({ append: removeLink});  
                      });
                      &lt;/script&gt;
                      &lt;div class="clearfloat"&gt;&lt;/div&gt;
  
                      &lt;!--&lt;input class="add clientadd" rel=".clone" onClick="addRow(this.form);" type="button" value="جديد" /&gt;--&gt;
                      &lt;div class="clearfloat"&gt;&lt;/div&gt;
  
                   &lt;/div&gt;
  </code></pre>
  
  <p>i have Googled about it but i didn't reach any thing</p>