$('#label-user').click(function(){
if ($('#label-user').style.display != 'none') {
$('#label-user').css('display', 'none');
}
});
$('#label-user').click(function(){
if ($('#label-user').style.display != 'none') {
$('#label-user').css('display', 'none');
}
});
The .style.display
syntax is for native JavaScript, as you are using jQuery it would be .css('display') != 'none'
.
You can also do everything in-house within the callback:
$('#label-user').click(function(){
if (this.style.display != 'none') {
this.style.display = 'none';
}
});
Or using jQuery with .hide()
:
$('#label-user').click(function(){
$(this).hide();
});
In fact it seems to me that it would suffice
$('#label-user').click(function(){
this.style.display = 'none';
});
Because a hidden element can not click anyway ...