js取消单选按钮选中并判断对象是否为空
内容摘要
一组单选按钮name都为country 复制代码 代码如下: var country = document.getElementsByName('country'); for(var i=0;i<country.length;i++){ if(country[i].checked) {
文章正文
一组单选按钮name都为country
var country = document.getElementsByName('country');
for(var i=0;i<country.length;i++){
if(country[i].checked)
{
country[i].checked=false; //不选中
}
}
<c:if test="${shippingAddressList != null && not empty shippingAddressList}"> //判断集合shippingAddressList 是否为空
复制代码 代码如下:
var country = document.getElementsByName('country');
for(var i=0;i<country.length;i++){
if(country[i].checked)
{
country[i].checked=false; //不选中
}
}
<c:if test="${shippingAddressList != null && not empty shippingAddressList}"> //判断集合shippingAddressList 是否为空
代码注释