채택완료

radio 체크하면 tr이 보이지 않도록...

2015-05-17 (일) 17:12:09 4,889

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

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

 

이걸 체크하면 

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

|

답변 2개

채택된 답변
+20 포인트

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

한번 참고해보세요~

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

[html]

Copy
<input type="radio" value="hide" id="sense1" name="sense"><label for="sense1">숨기기</label><input type="radio" value="show" id="sense2" name="sense"><label for="sense2">보이기</label><table border="1">  <tr>    <td>11111</td>    <td>22222</td>  </tr>  <tr class="red">    <td>33333</td>    <td>44444</td>  </tr>  <tr class="red">    <td>55555</td>    <td>66666</td>  </tr>  <tr>    <td>77777</td>    <td>88888</td>  </tr>  <tr>    <td>99999</td>    <td>00000</td>  </tr></table>
​

[js]

Copy
$('input[name="sense"]').change(function(){  if($('input[name="sense"]:checked').val() === "hide"){    $('.red').hide();  } else {    $('.red').show();  }});
​ 

  참고하세요.

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

  });​

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