How to make tooltip on jq?

Hello!
Tried to do a popup and got stuck.
Wrote a logic where when you click on ,question prompt appears. She has to hide when user clicks anywhere I ordered html.
The problem is that the script always yields none.
How to make?

$(document).ready(function () {

 var cvv = $('#cvv-info');

 $('.question').on('click', function() { 
 if(cvv.css("display") == "none"){
 $('#cvv-info').css("display", "block");
 $('.question').css("opacity", "0");
}
});

$('html').click(function(){
 if(cvv.css("display") == "block"){
 $('#cvv-info').css("display", "none");
 $('.question').css("opacity", "1"); 
}
});
});
June 10th 19 at 14:41
1 answer
June 10th 19 at 14:43
Well, that's still possible, for example:
$(document).on("click", function(event) { 
 if (!$(event.target).closest('.question').length){
$("#cvv-info").hide();
event.the stoppropagation();
}

});

Find more questions by tags jQueryJavaScript