테스트 사이트 - 개발 중인 베타 버전입니다

radio 체크하면 tr이 보이지 않도록... 채택완료

우엉수를설 10년 전 조회 4,620

radio 체크하면 div나 td가 보이지 않도록 하는 방법이 알고 싶어요. 

 

<input type="radio" value="check" id="sense" name="sense">

 

이걸 체크하면 

 

특정 게시판 필드 tr이 안보이게 하고 싶습니다 ㅜㅜ 여러곳에 응용이 가능할 것 같은데 보고 배낄 사이트도 없고해서 여기 물어보게됐습니다. 바로 채택할게요 고수님들 꼭 답변해주세요 ...

 

 

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
10년 전

예전에 비숫한 거 짠 적이 있는데...

한번 참고해보세요~

 

http://jsbin.com/nafato/1/edit?html,js,output">http://jsbin.com/nafato/1/edit?html,js,output 

 

[html]

</p><p><input type="radio" value="hide" id="sense1" name="sense"><label for="sense1">숨기기</label></p><p><input type="radio" value="show" id="sense2" name="sense"><label for="sense2">보이기</label></p><p><table border="1"></p><p>  <tr></p><p>    <td>11111</td></p><p>    <td>22222</td></p><p>  </tr></p><p>  <tr class="red"></p><p>    <td>33333</td></p><p>    <td>44444</td></p><p>  </tr></p><p>  <tr class="red"></p><p>    <td>55555</td></p><p>    <td>66666</td></p><p>  </tr></p><p>  <tr></p><p>    <td>77777</td></p><p>    <td>88888</td></p><p>  </tr></p><p>  <tr></p><p>    <td>99999</td></p><p>    <td>00000</td></p><p>  </tr></p><p></table> </p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;">

 

[js]

</span></p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;"></span>$('input[name="sense"]').change(function(){</p><p>  if($('input[name="sense"]:checked').val() === "hide"){</p><p>    $('.red').hide();</p><p>  } else {</p><p>    $('.red').show();</p><p>  }</p><p>});<span style="font-size: 14.6666669845581px; line-height: 1.5;"> </span></p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;">
 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

d
10년 전

  참고하세요.

$("#sense").click(function() {
    if(this.is(':checked')) $('#tr아이디').hide();

  });​

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인