2013-03-15 2 views
0

에는 jquery와 css로 차려 입은 형식의 라디오가 있습니다. 지금 나는 그것에 더 jquery을하고 싶지만 두 코드를 실행하면 라디오가 선택되면 리가 닫히지 않는다. 일단 리가 닫아야 할 라디오 비트 톤을 클릭하십시오. 또한 다음을 수행하도록 지시해야합니다. 선택한 라디오 스왑을 input = name "radio_selected"로 가져옵니다. 숨겨진 li에서 선택한 라디오가 숨겨진 li에서 벗어나 페이지에 숨겨져 있지 않은 위치로 바뀝니다.나는 목표물을 대상으로합니다.

$("input[name='domain_ext']").each(function() { 
     $("#radio_select").attr('checked', 'checked'); 
     var lbl = $(this).parent("label").text(); 
     if ($(this).prop('checked')) { 
      $(this).hide(); 
      $(this).after("<div class='radioButtonOn'>" + lbl + "</div>"); 
     } else { 
      $(this).hide(); 
      $(this).after("<div class='radioButtonOff'>" + lbl + "</div>"); 
     } 
    }); 

    $("input[type=radio]").change(function() { 
     $(this).siblings('.radioButtonOff').add('.radioButtonOn').toggleClass('radioButtonOff radioButtonOn'); 
    }); 



    $('div.ribbonBoxarrow').click(function() { 
      $('.ribbonBoxarrow li').show('medium'); 
      return false; 
     }); 
// once you leave the div (which is contained in the above li hide. 
     $('.ribbonBoxtab').mouseleave(function() { 
      $('.ribbonBoxarrow li').hide('slow'); //missing . 
      return false; 
     }); 
//if a radio buttn is clicked the hide li 
     $("input[name='domain_ext']").click(function() { //changed .each to .click 
      $('.ribbonBoxarrow li').hide('slow'); //missing . 
      return false; 
     }); 
+0

제거 경고 (화재), 단지 경우 작업을 테스트하는 데 사용하지만 – alwayslearning

답변

1
$("input[name='domain_ext']").each(function() { 
     $("#radio_select").attr('checked', 'checked'); 
     var lbl = $(this).parent("label").text(); 
     if ($(this).prop('checked')) { 
      $(this).hide(); 
      $(this).after("<div class='radioButtonOn'>" + lbl + "</div>"); 
     } else { 
      $(this).hide(); 
      $(this).after("<div class='radioButtonOff'>" + lbl + "</div>"); 
     } 
    }); 

    $("input[type=radio]").change(function() { 
     $(this).siblings('.radioButtonOff').add('.radioButtonOn').toggleClass('radioButtonOff radioButtonOn'); 
    }); 



    $('div.ribbonBoxarrow').click(function() { 
      $('.ribbonBoxarrow li').show('medium'); 
      return false; 
     }); 
// once you leave the div (which is contained in the above li hide. 
     $('.ribbonBoxtab').mouseleave(function() { 
      $('.ribbonBoxarrow li').hide('slow'); //missing . 
      return false; 
     }); 
//if a radio buttn is clicked the hide li 
     $("input[name='domain_ext']").parent('label').click(function() { //changed .each to .click 
      $('.ribbonBoxarrow li').hide('slow'); //missing . 
      return false; 
     }); 
+0

$ ("입력 [이름 = 'domain_ext']"). 부모 ('라벨'). (클릭 ... . 레이블 입력을 숨기고 절대로 놓치지 마십시오. – makedon

+0

안녕하세요. 사용해 주셔서 감사합니다. – alwayslearning

관련 문제