When my modal window is visible, when i click on #screen or on #loading_modal i need to hide this div's, but how can i do that, and how to write it correctly, now my code is not working, but also i have same for two objects (#screen, #loading_modal).... I'm new in js, how to refactor this code, and make it working properly... ?
if ($('#screen').is(':visible')) {
$("#screen").click(function() {
$('#screen').hide();
$('#loading_modal').hide();
});
$("#loading_modal").click(function() {
$('#screen').hide();
$('#loading_modal').hide();
});
}