I understand a bit because of this post: JQuery, setTimeout not working why it’s not working, but keeping everything this way, what is the right way to call _finalvalidate() inside my div?
<script type="text/javascript">
$(document).ready(function(){
//On Submitting
function _finalvalidate(){
alert('ppp');
if(validateName() & validateEmail() & validatePhone()){
alert('OK');
return true
}
else{
alert('false');
return false;
}
}
});
</script>
<div onclick="_finalvalidate();"> Take action </div>
The jQuery way of doing it would be something like:
If you really want to use the javascript function style, you gonna have to put the function outside the
document.ready()function and then you’ll be able to call it with theonclickattribute:In this case you don’t have anymore jQuery involved.