How to hide a div?
Posted: Thu Aug 29, 2024 6:53 pm
Hi,
I set this code in Page_load of the listpage in order to hide a div with id="fmad"
function Page_Load()
{
$('#fmad').hide();
}
but I get js error
Anyone can help please?
Hi,
I set this code in Page_load of the listpage in order to hide a div with id="fmad"
function Page_Load()
{
$('#fmad').hide();
}
but I get js error
Anyone can help please?
You should put the jQuery code under Client Scripts -> Startup Script that belongs to the current page, and not in the server event.
It works well, tnx
but when I set this:
$user_level = CurrentUserLevel();
if($user_level == 0 {
$('#fmad').hide();
}
else
{
$('#fmad').show();
}
the div is showing independently of the user level
CurrentUserLevel()
is PHP, you cannot mix server side PHP code into client side JavaScript, you should output it by, e.g. <?= CurrentUserLevel() ?>
. (Note that you have syntax error also.)
You may try:
$user_level = <?= CurrentUserLevel() ?>;
if ($user_level == 0) {
$('#fmad').hide();
} else {
$('#fmad').show();
}
Thank You, it works