JQuery code problem

             //attrprop propattr
             $("-sharpbtn1").click(function () {
                 // $("-sharpck").attr("checked","true");
                 $("-sharpck").prop("checked",true);//true
             });
             $("-sharpbtn2").click(function () {
                 $("-sharpck").prop("checked",false);
             });

I would like to ask why the false and true here do not need quotation marks, and what is the reason for the usual use of quotation marks?

Apr.05,2021

checked is already a Bool. why do you add quotation marks? don't quotation marks become string?

prop ("checked", "false") will also be treated as a check box, which is certainly not the effect you want, is it?


Isn't it a string to add double quotation marks to

? The picture posted on the first floor has made it very clear that a value of type boolean is required.

it is recommended to do the basics of DOM and JS first.


https://developer.mozilla.org.
applies only to attributes of type" checkbox "or" radio "elements

< table > < tbody > < tr > < td > checked < / td > < td > boolean: Returns / Sets the current state of the element when type is checkbox or radio. < / td > < / tr > < tr > < td > defaultChecked < / td > < td > boolean: Returns / Sets the default state of a radio button or checkbox as originally specified in HTML that created this object. < / td > < / tr > < tr > < td > indeterminate < / td > < td > boolean: indicates that the checkbox is neither on nor off. Changes the appearance to resemble a third state. Does not affect the value of the checked attribute, and clicking the checkbox will set the value to false. < / td > < / tr > < / tbody > < / table >

suggest buying a book to learn the basics of DOM and js


is no longer a string with quotation marks, but a Boolean type


clipboard.png

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-1b3bc8b-2c2b3.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-1b3bc8b-2c2b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?