I am doubtful for this system in Jquery
,
The idea is to click EDITAR
on a particular line to only activate the inputs
of that particular line of edit
clicked.
There are also two Edit Privilege, ADM e NORMAL
, NORMAL
should only edit the column NOME, o ADM
the columns NOME e SALARIO
this I got.
Challenge Adm Normal
<table border="1">
<tr><td>Operações</td><td>Nome</td><td>Salário</td></tr>
<tr>
<td><input class="edit" type="button" onclick="edit('editar')" value="Edit"><input class="excluir" type="button" onclick="excluir()" value="Excluir"></td>
<td><input disabled class="nome" type="text" name="nome"></td><td><input disabled class="salario" type="text" name="salario"></td>
</tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
</table>
</body>
<script type="text/javascript">
var op = "";
var privilegio = "";
function acesso(op){
privilegio = op;
}
function edit(){
if(privilegio == 'adm'){
$(this).parent().next().find('.salario').removeAttr('disabled');
$(this).parent().next().find('.nome').removeAttr('disabled');
}
else{
$('table').find('.nome').removeAttr('disabled');
}
}
</script>