Jesus A. Jesus A. - 10 days ago 5
Javascript Question

Remove css attribute as ajax reponse is executed

First I have a hidden div

<div id="save" class="form-group hidden ">
<div class="modal-footer">
<button type="button" id="btnUu" class="btn btn-primary"><i class="fa fa-download"></i> Save</button>
</div>
</div>


I want to remove
hidden
attribute when my ajax call is executed:

Ajax:

function GetSchoolMan() {
debugger;
currentId = 0;

try {
$(function () {
$.ajax({
cache: false,
type: "get",
dataType: "json",
url: "/LogWaste/GetForEdit",
data: { manifest: manifest },
contentType: "application/json; charset=utf-8",
success: onGetModulLogWasteSuccess,
error: function (response) {
ErrorMessage("Error", GetTextError(response));
}
});
});
} catch (e) {
ErrorMessage("Error", e.message);
}
}


I try to add
$('#save').removeAttr('hidden');
at the top of my ajax call like

function GetSchoolMan() {
debugger;
currentId = 0;
$('#save').removeAttr('hidden');
try {...


but it didnĀ“t work, how can I make it work? Regards

Answer

There is no attribute hidden on #save. You have a css class. Use this to remove it

$('#save').removeClass('hidden');
Comments