The button is not disabled when the page is loaded, and it takes effect when I check it.

html Code:

$(document).ready(function(){
    $("-sharprememberMe").change(function(){
        if($(this).is(":checked") == true){
            alert("");
            $("-sharpregisterBtn").removeClass("disabledBtn").addClass("enabledBtn");
        }else{
            //
            $("-sharpregisterBtn").removeClass("enabledBtn").addClass("disabledBtn");
        }
    });
});

I added pop-up window debugging, the expected effect should be pop-up enabled, but not.
I checked again before the pop-up window.
to put it simply, it is not checked by default. After the page is loaded, the button is not disabled

.
Mar.04,2021

you are just stating your code, not explaining your problem. You have to tell the problem, what you want to look like and what effect you want to have. You can't let us guess. This is the quickest way to solve the question.

I guess you want the button to be unclickable when the page loads? The solution is:
1, modify it in dom, add the checked= "checked" attribute to check it, or set nothing to let it not check;
2, try to use .prop ('checked') as the method to detect check.

if neither of them meets your expectations, it is recommended that you set debugger, on top of the if statement to check debugging.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3cf28-2bb9f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3cf28-2bb9f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?