Jetzt habe ich nämlich das Problem dass ich JS OO programmieren und nicht weiss, wie ich eine validierungsfunktion von der return onsubmit aufrufen kann.
Code:
<form method="post" action="#" onsubmit="return Test.onsub();">
<input type="text" placeholder="Name" />
<button type="submit">OK</button>
</form>
<script>
$(document).ready(function(){
new Test();
});
var Test = function(){
var onsub = function(){
alert("TEST");
return false;
}
this.onsub = function(){
alert("TEST");
return false;
}
};
Test.prototype.onsub = function(){
alert("TEST");
return false;
}
</script>