2017-12-31 124 views

답변

0

당신은 다음과 같은 오류를

구문 오류가 발생합니다 브라우저에서이 코드를 인식 할 수없는 표현 실행할 때 : 입력 : 라디오 [@ 이름 = selectRadioGroup] : 확인 됨

그렇게 선택기를 사용하는 동안 오류가 있고, 기본적으로

var row = $(this).closest('tr'); 
var status = row.find("input:radio[name=selectRadioGroup]:checked").val(); 
1

선택기는 string해야 helpin되지 않습니다. @name에서 @ 기호도 제거하십시오.

row.find('input:radio[name="selectRadioGroup"]:checked') 

데모

console.log($('input:radio[name="selectRadioGroup"]:checked').val());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<input type="radio" name="selectRadioGroup" value="1" checked> 
 
<input type="radio" name="selectRadioGroup" value="2" >

0

처럼 따옴표로 표현 @ 기호를 제거하고 묶습니다. 선택자는 문자열이어야합니다.

당신은 다음과 같은 코드를 사용하여 수행 할 작업을 얻을 수 있습니다

<table> 
<tr id="row"> 
<td> <input type="radio" name="radio_example" value="10" checked> 
</td> 
</tr> 
</table> 

//jquery 

var status =              
     $('#row input:radio[name="radio_example"]:checked').val(); 
console.log(status); //it will output 10