我試圖選擇從包括檢查單選按鈕(一個或多個)的值的形式的所有輸入值,使用下面的代碼的按鈕:選擇與其他輸入沿檢查單選按鈕值
$("form#second :input:not(:button)").each(function() {
values += $(this).val() + "\n";
});
console.log(values);
我知道我可以使用類似這樣的方式檢查單選按鈕的值:
$("form#second :input[name=radioBtn]:checked)
有沒有一種方法可以將兩者結合起來?獲取檢查單選按鈕的所有輸入包括價值
<form id="second">
<select>
<option value="val">Value</option>
</select>
<input type="button" value="Del" >
<button id="btnAdd" class="button" type="submit" >Add</button>
<textarea id="csTopic" name="comment">Some value</textarea>
<input type="radio" id="yes" name="radioBtn" value="yes">
<input type="radio" id="no" name="radioBtn" checked value="no">
</form>
您可以提供您的表單代碼! –
@DavidJorHpan HTML添加 – hello