2013-01-16 2 views
0

좋아요, 다시 한번 jQuery 유니폼 테마와 관련된 문제가 있습니다. http://uniformjs.com/ 행을 추가 (복제) 또는 제거하기 위해 텍스트 입력, 드롭 다운 및 버튼이있는 행을 복제하고 있습니다. 문제는 일단 행을 복제하면 새 행에서 드롭 다운 선택을 변경할 수 없다는 것입니다. 유니폼 기능을 비활성화하면 작동합니다.복제 된 드롭 다운이 jQuery 유니폼 테마와 함께 작동하지 않습니다.

<!---<script type="text/javascript" charset="utf-8"> 
    $(function(){ 
    $("input:text, input:file, select, textarea, input:button").uniform(); 
    }); 
</script>---> 

여기 내 코드입니다. 통일 된 업데이트가 작동하지 않는 것 같습니다.

// 
id=0; 
$("table#customers_tab img.remove").live("click", function (event) { 
     $(this).parents("tr").remove(); 
    var remove_id = event.target.id; 

    var index = remove_id.substring(6); 

    var table = document.getElementById("customers_tab"); 
    for(var i=parseInt(index); i<table.rows.length;i++){ 
    $($('table#customers_tab tr')[i]).find("img.add").attr("id","add"+i); 
    $($('table#customers_tab tr')[i]).find("img.remove").attr("id","remove"+i); 

    } 

    }); 

$("table#customers_tab img.add").live("click", function (event) { 
     id++; 
     var master = $(this).parents("table#customers_tab"); 
     var add_id = event.target.id; 

    var index = add_id.substring(3); 

    var prot = $($('table#customers_tab tr')[index]).clone(); 
    var incr = parseInt(index)+1; 

    prot.find("img.add").attr("id","add"+incr); 

     $('.feature').live('change',function(){ ////SOLUTION HERE 
      $.uniform.update("select"); //// 
     }); //// 

    $($('table#customers_tab tr')[index]).after(prot); 
    var table = document.getElementById("customers_tab"); 

    for(var i=incr+1; i<table.rows.length;i++){ 
    $($('table#customers_tab tr')[i]).find("img.add").attr("id","add"+i); 
    $($('table#customers_tab tr')[i]).find("img.remove").attr("id","remove"+i); 

    } 
    $.uniform.update(); //NOT WORKING 
    }); 
$("#delAllCustomers").live("click", function (event) { 
    $("#customers_tab").children().remove(); 
}); 
// 

이것은 내 문제와 매우 유사하지만 문제를 해결하지 못했습니다. jquery cloning a block of element. select element acting weired

답변

0

이러한 특정 새 요소에 유니폼을 추가해야합니다. 요소에 제복을 추가 한 다음 다시 동일한 요소에 추가하면 끊어집니다. 단지

$("#newID1 input:text, #newID2 input:file, #newID3 select, #newID4 textarea, #newID5 input:button").uniform(); 

나 :

$("#newID select").uniform(); 
+0

음, 위의 코드는 이제 작동 당신은 뭔가를 시도하려는. 나는 그것을 편집했다, 당신을위한 감사합니다. :디 – triplethreat77

관련 문제