c# + JQurey에서 radio와 checkbox 값을 가져옵니다.

2380 단어
쓸데없는 말은 하지 말고 바로 코드를 찍어라
 
  





<br/> <script src="jquery-1.8.0.js"/> <br/> <script type="text/javascript"> <br> $(function () { <br> $("#sub").click(function () { <br> var str1 = " :" + $("#name").val(); <br> var str2 = " :" + $('input:radio[name = "sex"]:checked').val(); <br> var shuzu = []; <br> $('input:checkbox[name = "aihao"]:checked').each(function () {//each <br> shuzu.push($(this).val());// <br> }); <br> window.alert(str1 + '<br>' + str2 + '<br>' + " :" + shuzu); <br> }); <br> }); <br> </script> <br/> <br/> <br/> <form id="form1" runat="server"> <br/> :<input type="text" id="name"/><br/> <br/> :<input type="radio" id="nan" name="sex" checked="" value=" "/> <input type="radio" id="nv" name="sex" value=" "/> <br/> <br/> :<input type="checkbox"/> <br/> <input type="checkbox" name="aihao" value=" "/> <br/> <input type="checkbox" name="aihao" value=" "/> <br/> <input type="checkbox" name="aihao" value=" "/> <br/> <input type="checkbox" name="aihao" value=" "/> <br/> <input type="checkbox" name="aihao" value=" "/> <br/> <br/> <input type="button" id="sub" value=" "/><input type="button" id="b" value=" "/> <br/> </form> <br/> <br/> <br/> </code></pre> <p> , , 。</p> <div class="clearfix"> <span id="art_bot" class="jbTestPos"/> </div> </div> </div> </div>

좋은 웹페이지 즐겨찾기