Como executar uma função em javascript dentro de código jquery?

Como posso executar uma função em javascript dentro de código jquery?
Tenho o seginte código em javascript:

function validar(){ var usuario = document.getElementById("txtUsuario"); var senha = document.getElementById("txtSenha"); if(usuario.value == "" && senha.value == ""){ alert("informe seu nome de usuário e senha de acesso!"); formLogin.txtUsuario.focus(); return false; } if(usuario.value.length <= 8 && senha.value.length <= 8){ alert("nome de usuário / senha inválido!"); formLogin.txtSenha.focus(); return false; } if(usuario.value != "" && senha.value != ""){ if(usuario.value.length >= 8 && senha.value.length >= 8){ alert("olá " + usuario.value); return false; } } return true; }

Quero chamar o código acima dentro do seguinte código em jquery:

$("btn").ready(function{ $(this).click(); });
OBS: ambos os códigos estão em arquivos separados.
Alguém poderia me ajudar?
Desde já agradeço a atenção. :wink:

Importa os arquivos onde estão seus scripts dae, vc chama essa sua função de validar detro do evento de click, fica assim:

Você poderia dar um exemplo? :wink:

$("btn").ready(function(){   
    $(this).click(function(){
       var usuario = document.getElementById("txtUsuario");
       var senha = document.getElementById("txtSenha");
       if(usuario.value == "" && senha.value == ""){
          alert("informe seu nome de usuário e senha de acesso!");
          formLogin.txtUsuario.focus();
          return false;
       }
       if(usuario.value.length <= 8 && senha.value.length <= 8){
          alert("nome de usuário / senha inválido!");
          formLogin.txtSenha.focus();
          return false;
       }
       if(usuario.value != "" && senha.value != ""){
          if(usuario.value.length >= 8 && senha.value.length >= 8){
             alert("olá " + usuario.value);
             return false;
          }				
       }
       return true;
    });   
});  

jQuery sempre me confunde hehehe, mas veja se isso funciona