Most people probably think of this method when verifying:
function chk () //Verify whether it is selected return true, if not return false
{
var falg = 0;
$("input[name=cbname]:checkbox").each(function( ){
if($(this).attr("checked")) // Here you can use if($("#cr").is(":checked"))
{
falg =1; // You can add return false here to exit the loop
}
})
if(falg >0)
return true;
else
return false;
}
This method is really good, but I think the following code is simpler and more efficient:
if($("input[name=cbname]:checkbox").length==0 ) // None of the options are selected
Selected according to needs
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn