Fraser_Admin
asked on
Javascript hide button
I need to know how to make an input button hidden from javascript. I'm finding my input button by using the eval function
var obj = eval(Type + ID);
I then need to be able to say something like
if (Type == 'Sub')
{
obj.visibility = 'hidden';
}
else
//make it visible
But this doesn't seem to work.
var obj = eval(Type + ID);
I then need to be able to say something like
if (Type == 'Sub')
{
obj.visibility = 'hidden';
}
else
//make it visible
But this doesn't seem to work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
and obj irepresents the name of your button, b_name in this example:
<input type="submit" name="b_name" value="OK" >
<input type="submit" name="b_name" value="OK" >
Brunobear is correct. "obj.style.visibility = 'hidden';" will do the job as long as you want the button to still affect layout. (That is, if you want an empty space where the button would be if it was visible.)
If you don't want the empty space, "obj.style.display = 'none';" is what you are after.