묻고답하기

//자동완성    
$("#product_name").bind("focus", function(){
      $(this).autocomplete({
        source:'autocomplete',
        minLength:2,
        select:function(event, ui){
        //  $('#product_name').val(ui.item);
          $(this).on('blur', function(){
            //alert($("#product_name").val());
            $(this).parent().next().next().children().first().val(ui.item.price);
          });
        }
      })
    });

  // +버튼 클릭시 tr라인 추가
  $("#addItemBtn").click(function(e){

      e.preventDefault();
      cnt = $(".tr_flag").length;
      //alert(cnt);
              


              //clone
              $.trClone = $("#memberTable tr:last").clone(true).html();
              $.newTr =   $("<tr class='tr_flag'>"+$.trClone+"</tr>");

              //  var lastItemNo = $("#memberTable tr:last").attr("class").replace("item","");

              // $.newTr.find(".pn").attr("id","product_name_"); //+cnt

              //append
              $("#memberTable").append($.newTr);

              //delete Button추가
              $.btnDelete = $(document.createElement("input"));
              $.btnDelete.attr({
                name:"btnRemove",
                type:"button",
                class:"btn btn-danger",
                value:"-"
              });

              $("#memberTable tr:last td:last").html("");
              $("#memberTable tr:last td:last").append($.btnDelete);

              $("#memberTable tr>td:last>input[type='button']").on('click', function(){
                $(this).parent().parent().remove();
              });

           });

 

  <div class="form-group">
            <h4> Add products</h4>
            <button id="addItemBtn">+</button>
            <table class="table col-sm-12" id="memberTable">

              <tr>
                <th>Product </th><th>Size &Color </th><th>Price </th><th>Quantity </th><th>Total </th><th>Sales Price </th><th>remove</th>
              </tr>



                  <tr>
                    <td>{!! Form::text('product_name',null,['class'=>'form-control pn', 'id'=>'product_name' ])!!}</td>
                    <td>
                      {!! Form::text('size_color',null,['class'=>'form-control'])!!}
                    </td>
                    <td>
                      {!! Form::text('price','0',['class'=>'form-control','id'=>'price','readonly'])!!}
                    </td>
                    <td>
                      {!! Form::text('quantity','0',['class'=>'form-control','id'=>'quantity'])!!}
                    </td>
                    <td>
                      {!! Form::text('total',null,['class'=>'form-control','id'=>'total','readonly'])!!}
                    </td>
                    <td>
                      {!! Form::text('sales_price',null,['class'=>'form-control'])!!}
                    </td>
                    <td>

                    </td>


                  </tr>






            </table>

 


Add product의 + 버튼을 누르면   테이블의  tr한줄을 clone으로 복사하는 기능인데요

 

여기 첫번째 input text에 jquery UI의 autocomplete 함수는동작되는데

 

추가되는 input text에도 똑같이 autocomplete함수가 동작하지 않습니다.

 

 

추가되는 텍스트 박스에도 똑같이 함수가 동작되게 하고싶은데 안되네요

 

 

어떻게든 동작하게 하고싶어서 id에 증가 값을 주고 해보기도 했는데 (함수를 여러개 만드는 방법) 그것도 동작을 안하더라구요  어떻게 해야 깔끔하고 쉽게 동작하게 할수 있을까요?

 

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
joorans 문의게시판 만들려고 합니다  
고양이냥 sweet mobile 레이아웃 상단이 뜨는데 [1] 2015.10.16 by 키스투엑스이
머리 드림위버에서 작성한 홈페이지에 ex보드를 삽입할 수 있나요? [1] 2015.10.16 by 키스투엑스이
sports21 검색이 안됩니다.  
큐원 스케치북 모바일에서 글과 사진 모두 등록은 되지만..ㅠㅠ [2] 2015.10.15 by 큐원
예란 타임라인 모듈 카테고리 목록에서 게시판 추가하는 방법 [2] file 2015.10.15 by 예란
spaz 익스에선 이상이 없는데 크롬에서 댓글작성이 안되고 경고창이 뜹니다 [3] 2015.10.15 by treasurej
thdwjdtjr 태그 작성하는 법..... ??? [2] file 2015.10.15 by thdwjdtjr
고양이냥 ssl 인증서 설치 완료했는데 B등급이 나왔어요 [8] 2015.10.15 by 고양이냥
고양이냥 서버 호스팅보면 ssd + 1tb 하드 이던데 [4] 2015.10.15 by 고양이냥
에이치오 &nbsp; 이것이 게시글 저장시 ? 로 변경되어 저장됩니다. [1] 2015.10.15 by treasurej
열혈개발 썸네일 폴더 삭제해도되나요? [1] 2015.10.15 by treasurej
파워XE 관리자 로그인시 에러나 납니다. 도와주세요.. [4] 2015.10.15 by 파워XE
아이돌72 스케치북 스킨에서 카카오 링크 오류 발생 문제 [4] 2015.10.15 by 아이돌72
전갈자리남 회원가입시 문자 관련 [1] 2015.10.15 by 기진곰
까꿍 게시판 만드는 방법 [1] 2015.10.15 by u****
thdwjdtjr 태그 뜻이 무엇을 의미하는 것 인지요 [2] file 2015.10.15 by thdwjdtjr
hittttte xe 게시판관련이요 ㅠㅠ [ 게시글이사라짐 ]  
u**** 안녕하세요 jquery를 사용하는데 초보적인 질문이 있습니다. [1] file 2015.10.15 by u****
전갈자리남 웹호스팅 서버호스팅 SSL관련 [2] 2015.10.15 by 전갈자리남