Open rashnk opened 5 years ago
Validator works when I use data-toggle="validator" <form id="ppForm" data-toggle="validator" action="https://xxx-xx.xx.com/" method="POST" >
<form id="ppForm" data-toggle="validator" action="https://xxx-xx.xx.com/" method="POST" >
but when I try to activate it from javascript , it does not work
<!-- CDN --> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js" ></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.9/validator.min.js" ></script> <!-- CDN -->
var options = { delay: 5000, custom: { equals: function($el) { var matchValue = $el.data('equals'); // foo debugger; if ($el.val() !== matchValue) { return "Hey, that's not valid! It's gotta be " + matchValue; } } } }; $('#ppForm') .validator(options) .on('submit', function(e) { alert('e'); if (e.isDefaultPrevented()) { // handle the invalid form... alert('e'); return; } else { // everything looks good! sbmtForm(); } });
Validator works when I use data-toggle="validator"
<form id="ppForm" data-toggle="validator" action="https://xxx-xx.xx.com/" method="POST" >
but when I try to activate it from javascript , it does not work