Hi all. I've done some searching, but being new to this am struggling
to find what I'm after even though I'm sure the answer is simple.

I'm in at the deep end working with a webapp that uses JQuery, I
presume with various plugins for form validation. I have some code as
follows:

jQuery(document).ready(function() {

                if ($("#createNewAccount").is(":checked")){
                        jQuery('div.showHideAccountDetails').show();
                }else{
                        jQuery('div.showHideAccountDetails').hide();
                }
}

But in some situations the variable 'createNewAccount' does not exist,
as the form element is not shown on the page. How can I test the
variable first? I'm thinking of something along the lines of:

if ( isDefined ( "#createNewAccount") ) {   // continue... }

Many thanks for any help!

Reply via email to