在JS
我有以下代码:
$('#botones').html('<button type="button" class="btn btn-success hvr-float-shadow pull-right" style="position: relative; bottom: 3px; border-radius: 20px;background: teal; border-color: teal;" onclick="LoadDataEvaluados()"> Evaluado </button>'
+ '<button type="button" class="btn btn-danger hvr-float-shadow pull-right" style="position: relative; bottom: 3px;right: 20px; border-radius: 20px;" onclick="LoadDataNoEvaluados()">No Evaluado</button>');
如您所见,每个botón
都有一个onclick
对应于 的funciones diferentes
,其想法是根据每个función
,可以从表中添加或删除一列...
HTML
<tr>
<th>ID</th>
<th>Cédula</th>
<th>Nombre</th>
<th>Apellido</th>
<th>resultados</th>
</tr>
(Esta tabla se encuentra en el html)
也就是说当你按下本botón 'evaluados'
例中包含它的那个时,función LoadDataEvaluados();
你可以将它添加到标签或列下面,否则它不显示<th>resultados<th>
<th>detalle<th>
<th>detalle<th>
我将不胜感激。(我无法尝试隐藏该列,因为数据表会引发错误。)
要添加元素,请使用append方法并删除它们remove。
请注意,在以下示例中,我仅添加和删除标题,实际上您应该使用所有行的单元格来执行此操作。使用 jQuery 选择器应该没有问题。
好吧,我认为你想要的是它不被隐藏,只是不被写入文档。好吧,我会通过以下方式做到这一点:
请对此进行验证。干杯
http://www.cubicfactory.com/jseditor/
HTML
JAVA脚本
---------------这是css
有两种方法
document.createElement("标签"); 其中“label”将是您使用的标签的名称
变量.innerHTML;你可以直接将带有innerHTML的全文添加到你的页面,但是所做的更改不会在js中被捕获,你知道吗?总之,你添加的元素,更多的功能不会那么容易处理。
运气
这是一个使用 datatanbles.net 库隐藏/显示结果
<thead>
标题的示例,但首先我将其放在表中,如下所示:现在在插件声明中,我将其保留为:
在按钮的功能中,我放置了以下内容:
功能示例
这个例子做你想做的,但不会让你对它们进行排序