View Single Post
Old 11-23-2012, 08:13 PM   PM User | #14
jswannabe
New Coder

 
Join Date: Nov 2012
Location: Canada
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
jswannabe is an unknown quantity at this point
Re:Post #2
I copied your code to hide a fieldset until checkbox checked by wrapping the fieldset in a div and it worked but I don't understand why it works.

I understand the CSS to hide it. I understand the html for the div, the input, and the onclick.
On the javascript side, I understand that you want the div's style to be set to display equal to when the checkbox is checked.
What I don't understand is:
Code:
function showFeat(box){
document.getElementById("feature").style.display=box.checked?"block":"none";
1. (box) - is box just a variable name or is it some inherent code for checkbox?
2. box.checked?"block":"none" - what are these called? nodes? attributes? I want to know what tutorial to google to learn how to understand and do this. It works like an if else statement but severely condensed. I'm amazed but it's not hard to amaze beginners.
jswannabe is offline   Reply With Quote