正如你最近在我的问题的历史中看到的那样,我正在尝试理解Jquery/Javascript :)我遇到了以下问题,并想向你们提出这个问题.
我有下表(注意:这是由inspect元素抓取的HTML,我不确定为什么style ="background-color:rgb(255,255,255);是吗...):
<table class="table table-striped table-condensed" id="instance-table">
<thead>
<tr id="checkrow">
<th><input type="checkbox" id="checkall"></th>
<th>Column A</th>
<th>Column A</th>
<th>Column A</th>
</tr>
</thead>
<tbody id="instanceInnerContent">
<tr style="background-color: rgb(255, 255, 255);">
<td class="act"><input type="checkbox"></td>
<td>Value 1</td>
<td>Value 2</td>
</tr>
<tr style="background-color: rgb(255, 255, 255);">
<td class="act"><input type="checkbox"></td>
<td>Value 1</td>
<td>Value 2</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
并使用以下代码选择行或全部选择它们或选择行单击:
// if user clicks on checkbox with id="checkall" - all checkboxes are selected
// and table row background is highlighted
$('body').on('click', '#checkall', function () {
$('input:checkbox:not(#checkall)').prop('checked',this.checked); …Run Code Online (Sandbox Code Playgroud) 我正在打破如何获得一个特定的孩子div id,哪个样式是块; 我一直在谷歌搜索和stackoverflow浏览漏洞的一天.
我可以通过以下方式让所有孩子:
var active = $('#myDiv').children().get();
Run Code Online (Sandbox Code Playgroud)
但我不知道如何过滤风格..get()之后不允许使用.attr().所以,我只想知道我之后需要使用它的id.
编辑:
这是我想要使用的完整功能:
// ON MODAL DISMISS, RESET STEPS
$('#myDiv').on('hidden', function() {
var currentStep = $('#myDiv').children().filter(function(){
return $(this).css('display') === 'block';
});
//console.log(currentStep);
replace(currentStep, step1);
});
function replace( hide, show ) {
document.getElementById(hide).style.display="none";
document.getElementById(show).style.display="block";
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<div id="myDiv">
<div id="step1">
...
</div>
<div id="step2">
...
</div>
<div id="step3">
...
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
目前,当我启动模态并完成步骤,但决定在步骤3中关闭模态并重新启动模态时,它将继续执行步骤3.因此,我认为在解雇之前我需要当前的步骤,所以我可以将它发送到我的替换函数并将currentStep的样式设置为none,并阻止第一步.
我正在使用jQuery来禁用某些表单按钮.简单的东西.但是,如何阻止用户编辑DOM并自行启用按钮,以便他们可以解决我实施的限制?