The problem with your code is that your function is not defined in the global context, but rather is defined inside the document.ready callback function. Thus, when the browser receives onclick and evaluates your string, it does not find this function name in the global context. You can fix this in several ways:
1) Change your function to be defined in the global scope, for example:
//On Submitting window._finalvalidate = function(){
2) Move the _finalvalidate()
function outside of document.ready()
so that it is in the global scope. There is no reason for it to be in document.ready()
, because it is not executed immediately.
3) Go to the "jQuery" method to specify event handlers instead of putting onclick = xxx in your HTML, as Corey shows in his answer.
source share