我跟随DIV显示了一些控件:
<div id="buttonrow" class="buttonrow">
<div class="Add" title="Add">
<div class="AddButton">
<input id="images" name="images" title="Add Photos" multiple="multiple" type="file">
</div>
<div class="AddText">
Add
</div>
</div>
<div class="Upload" title="Upload">
<div class="UploadButton">
<button id="start" type="submit" title="Upload Photos">
</button>
</div>
<div class="UploadText">
Upload
</div>
</div>
<div class="Clear" title="Clear">
<div class="ClearButton">
<button id="reset" type="reset" title="Clear Photos">
</button>
</div>
<div class="ClearText">
Clear
</div>
</div>
<div class="Delete" title="Delete">
<div class="DeleteButton">
<button id="delete" type="button" title="Delete Photos">
</button>
</div>
<div class="DeleteText">
Delete
</div>
</div>
<div id="SelectAll">
<input title="Select All Images" id="selectAllCB" type="checkbox">
</div>
<div id="dragandrophandler">
Drag & Drop Your Photos Here
</div>
<div id="ImagesCount">
</div>
<div id="Loading" class="Loading">
<img alt="loading" src="../customcontrol/progress.gif">
<div>
Loading...</div>
</div>
</div>
我需要知道如何使用Javascript / JQuery函数禁用整个DIV?
编辑:禁用DIV意味着用户不能与DIV控件进行交互。它们必须处于只读状态(不可点击)。我不想隐藏DIV!
答案 0 :(得分:2)
在Javascript中,您可以使用:
<script lnaguage="javascript">
document.getElementById('buttonrow').style.display='none';
</script>
答案 1 :(得分:1)
使用:
$("#buttonrow *").attr("disabled", "disabled").off('click');
答案 2 :(得分:0)
$("button, input",$("#buttonrow")).attr("disabled", "disabled");
答案 3 :(得分:0)
请你试试这个:
$("#buttonrow").each(function()
{
$(this).prop('disbaled',true);
});
希望这会有所帮助..
答案 4 :(得分:0)
$('#buttonrow').on('click', function(){
$(this).css({ 'opacity': 0.7 });
return false;
})
答案 5 :(得分:0)
使用.prop()
:
$("#buttonrow :input").prop("disabled", true);
:input
将选择所有输入元素,包括文本,文本区域,按钮,选择等。