JavaScript 'visibility' or 'display' - works in one copy not in identical copy

Dear Colleagues:

                            I have some javascript which is based on using the 'display' or the 'visibility' properties - either one is fine.  

The line of code that needs to either display or be hidden reads:

<span id="ifyes" style="display:none">  Blah, blah, blah...</span>

...this line using either 'display' or 'visibility' works fine - with the style in place it vanishes.

However, when one adds this javascript works in some scripts and not in others.

<script type="text/javascript">
    function yesnoCheck() {
        if (document.getElementById('yesCheck').checked) {
            document.getElementById('ifYes').style.display = 'block';
        } else document.getElementById('ifYes').style.display = 'none';


...that works and can be seen working as a jsfiddle at:

...I finally hand typed the identical code into another jsfiddle window... DOES NOT work, and yet it appears identical.  Running in a different browser and/or on a different O/S makes no difference (checked just in case...).

I need this functionality working in my own production code and I can not get it to work - can anyone tell me why the one script works and the other does not?  If I know why in these examples I can fix my own similar code.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
The second one is missing a ')' after 'checked'...

if (document.getElementById('yesCheck').checked) <<<<<<<

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.