jqueryjquery-validation-engine

Error while using jquery validation engine


I am trying to debug an old application and I created a separate html to debug jquery validation engine behavior.

I am getting this error:

jquery.validationEngine.js:28 Uncaught TypeError: $(...).on is not a function

This error points to line 28 of jquery.validationEngine.js

Here is my file:

<html>
<head>
<link rel="stylesheet" href="jQuery-Validation-Engine/css/validationEngine.jquery.css" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js" type="text/javascript"></script>
<script src="/jQuery-Validation-Engine/js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="/jQuery-Validation-Engine/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<script>
$(document).ready(function(){
  // binds form submission and fields to the validation engine
  $("#myform").validationEngine('attach', {promptPosition : "centerRight"});
  alert('hi');
});
</script>
</head>

<body>
<form method="post" name="myform" id="myform" action="processmyform.php">
<div>
<label>First name</label>
<input type="text" name="first_name" id="first_name" class="validate[required]" />
</div>
<div>
<label>Last name</label>
<input type="text" name="last_name" id="last_name" class="validate[required]" /><br>
</div>
<div>
<input type="submit" name="submit" value="Submit"/>
</div>
</form>

Thanks


Solution

  • You're using jQuery 1.4.4 but the .on() function was added in version 1.7