チェックボックスにチェックが入っていないと送信出来ないようにする

Ads

Result

jQuery

$('#check').click(function(){
     
    if($(this).prop('checked') == false){
         $('#submit').attr("disabled","disabled");   
    }
    else {
        $('#submit').removeAttr('disabled');
    }
});

html

<input type="checkbox" checked="checked" id="check"><a href="#">利用規約</a>に同意して送信する
<input type="submit" id="submit" value="submit">

via

How do i disable a submit button when checkbox is uncheck?


Warning: include(/home/youhei0828/kachibito.net/public_html/wp-content/themes/cocoon-master/my-php/jquery-other-snippets.php): Failed to open stream: No such file or directory in /home/youhei0828/kachibito.net/public_html/wp-content/themes/kachibito7_with_cocoon_child/functions-module/shortcode/add-post-myphp.php on line 7

Warning: include(): Failed opening '/home/youhei0828/kachibito.net/public_html/wp-content/themes/cocoon-master/my-php/jquery-other-snippets.php' for inclusion (include_path='.:/opt/php-8.1.29/data/pear') in /home/youhei0828/kachibito.net/public_html/wp-content/themes/kachibito7_with_cocoon_child/functions-module/shortcode/add-post-myphp.php on line 7