Estoy usando removeClass()removeClass()
para remover una clase que lo que hace es que me convierte el text en discs *****discos/asteriscos (*****), como un password el. El problema es que cuando lo utilizo me remueve los discos de la fila anterior.
$(".add-row").click(function() {
var param = $("#param").val();
var valor = $("#valor").val();
var markup = "<tr><td><input type='button' class='delete-row button green' value='Eliminar' name='record'></td><td><input type='button' class='delete-row button blue' value='Editar' name='record'></td><td>" + param + "</td><td class='hidetext'>" + valor + "</td></tr>";
$("table tbody").append(markup);
if (!document.getElementById("myCheck").checked) {
$('.hidetext').removeClass('hidetext');
}
$('input[type="text"]').val('');
$('input[type="password"]').val('');
});
Este es mi HTMLel código:
<div class="span-23 margin_bot margin_top_b text_form_fieldname">
<form>
<input class="input_text input_size text_input span-6" type="text" id="param" placeholder="Parametro">
<input class="input_text input_size text_input span-6" type="text" id="valor" placeholder="Valor">
<input class="myCheck" type="checkbox" id="myCheck" onclick="showPassword()">Ocultar
<input type="button" class="add-row button blue" value="Agregar">
</form>
<br>
<table style="width: 50%">
<thead>
<tr>
<th></th>
<th></th>
<th>Parametro</th>
<th>Valor
<th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
$(".add-row").click(function() {
var param = $("#param").val();
var valor = $("#valor").val();
var markup = "<tr><td><input type='button' class='delete-row button green' value='Eliminar' name='record'></td><td><input type='button' class='delete-row button blue' value='Editar' name='record'></td><td>" + param + "</td><td class='hidetext'>" + valor + "</td></tr>";
$("table tbody").append(markup);
if (!document.getElementById("myCheck").checked) {
$('.hidetext').removeClass('hidetext');
}
$('input[type="text"]').val('');
$('input[type="password"]').val('');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="span-23 margin_bot margin_top_b text_form_fieldname">
<form>
<input class="input_text input_size text_input span-6" type="text" id="param" placeholder="Parametro">
<input class="input_text input_size text_input span-6" type="text" id="valor" placeholder="Valor">
<input class="myCheck" type="checkbox" id="myCheck" onclick="showPassword()">Ocultar
<input type="button" class="add-row button blue" value="Agregar">
</form>
<br>
<table style="width: 50%">
<thead>
<tr>
<th></th>
<th></th>
<th>Parametro</th>
<th>Valor
<th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>