I want to do the following:
if (htmlEdit) {
var dialogDiv = $('#commonDialog');
} else {
var dialogDiv = $('#commonDialog2');
}
But if I do that I think dialogDiv will not be available outside of the if-else. How can I declare it so I will be able to use it in another place after the if-else?
you can do like this,
Here is a good tutorial,
http://www.webdevelopersnotes.com/tutorials/javascript/global_local_variables_scope_javascript.php3