![](/img/trans.png)
[英]How to set the value of form field based on another form field using react, typescript and formik?
[英]How can i set another form field based on a checkbox?
在這種情況下,請使用RADIO
而不是CHECKBOX
並確保兩個RADIO的名稱相同,以便可以隨時選擇,例如:
<input type="radio" value="1" name="scheduler">Send Now
<input type="radio" value="2" name="scheduler">Send At
您可以通過以下方式獲取選定的單選值:
$('input[name=scheduler]:checked').val();
並提出了if
條件,如:
if( $('input[name=scheduler]:checked').val() == 1 )
{
// Do some thing here
}
else
{
// Do some thing here
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.