I have this javascript code:
$().ready(function() {
$("#aceptarEditar").click(function(){
var item = $('#idTemp').val();
$("#botones"+item).toggle();
$("#botonesEditar"+item).toggle();
$("#txtNombre"+item).prop("disabled", false);
$("#txtDescripcion"+item).prop("disabled", false);
});
$("#aceptarSalir").click(function(e){
var item = $("#idTemp").val();
$("#botones"+item).toggle();
$("#botonesEditar"+item).toggle();
$("#txtNombre"+item).prop("disabled", true);
$("#txtDescripcion"+item).prop("disabled", true);
});
As you may notice, I repeat the variable twice:
var item = $("#idTemp").val();
Which, as you may notice, repeats both the name and value of this. That is why I only come to ask you if you could teach me the correct way to name this variable once because I use it twice, in one where a button is used to edit and another button to cancel when editing .