在html中禁用div元素 [英] Disabling div elements in html

查看:257
本文介绍了在html中禁用div元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



晚安,



如何使用javascript启用和禁用div?



在我的javascript函数中,我的方法是

函数Load()

{

var MultiLocation = document.getElementById (" chkMultiLocations");



var divSubGroup = document.getElementById(" divSubGroup");

document.getElementById(" divSubGroup")。disabled = true;

divSubGroup.innerHTML ="" ;;

document.getElementById(" divSubGroup")。innerHTML ="" ;;

divSubGroup.disabled = false;



}

我在
中调用了这个方法
< form id =frmGroupRegistrationonload =Load()onsubmit =ValidateForm(); action =GroupRegistration.aspxonscroll =truemethod =post>



不工作

请解释我withcode如何在html中禁用和启用div及其元素?



提前谢谢

Hi,
Good Evening,

How to make div enable and disable using javascript?

In my javascript function my method is
function Load()
{
var MultiLocation = document.getElementById("chkMultiLocations");

var divSubGroup = document.getElementById("divSubGroup");
document.getElementById("divSubGroup").disabled = true;
divSubGroup.innerHTML = "";
document.getElementById("divSubGroup").innerHTML = "";
divSubGroup.disabled = false;

}
and I have called this method in
<form id="frmGroupRegistration" onload="Load()" onsubmit="ValidateForm();" action="GroupRegistration.aspx" onscroll="true" method="post" >

It is not working
Please explain me withcode how to disable and enable div and its elements in html?

Thanks in advance

推荐答案

检查这个,其中一个可以适应您的需要:

示例

Check this out, one of them can be adapted to meet your need:
example



(#divSubGroup *) .attr(禁用,禁用)。off('click');
("#divSubGroup *").attr("disabled", "disabled").off('click');


这篇关于在html中禁用div元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆