简体   繁体   中英

Reset boolean value to false after ajax call

Got a rails app here with a basic form being submitted via Ajax. After the form has been submitted I am using the following code to reset a text form field:

$('#pitcher_game_stat_innings_pitched').val('')

This code works. I am now looking to similarly reset a few boolean fields back to unchecked. Something like this

$('pitcher_game_stat_complete_game').val(false)

What is the javascript method to change a boolean value back to false (unchecked)?

使用.prop设置属性状态,如选中

$('#pitcher_game_stat_complete_game').prop('checked', false)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM