Home > Web Front-end > JS Tutorial > body text

How to determine whether the CheckBox selected is empty

php中世界最好的语言
Release: 2017-12-30 17:59:15
Original
2652 people have browsed it

What I bring to you this time is how to determine whether the CheckBox selected is empty in JS. Here is a practical column for everyone to analyze.

var chk_value = [];//定义一个数组
//name是CheckBox的name属性定义的名称
$('input[name="time"]:checked').each(function () {
chk_value.push($(this).val());
});
  
if (chk_value.length < 1) {
alert("CheckBox选项为空")
return false;
}
  
alert(chk_value );
Copy after login

I believe you have mastered the method after reading the above introduction. For more exciting information, please pay attention to php Chinese website Other related articles!

Related reading:

Implementation steps for PHP cache optimization using memcached and xcache

Asynchronous synchronization in the use of AJAX How to implement the request

How to download and install nodejs

The above is the detailed content of How to determine whether the CheckBox selected is empty. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template