How to call the jquery function by onclick="return function()" ?
Hi,
In the HTML, I had add
onclick="return validate()" in the button HTML.
<input type="submit" id="form_save" value="Save"
onclick="return form_validate()">
Then, I had prepare the form_validate() function in a separate js file, it would work properly.
- function form_validation(){
- console.log('abc');
- return false;
- }
But, when I try to use the jquery function as usual by bounding (function ($) {})(jQuery), it show an error "
Uncaught ReferenceError: form_validation is not defined
".
How can I use the jquery function in form_validation() ?
- (function ($) {
- function form_validation(){
- console.log('abc');
- return false;
- }
- $('selector').click(...................) // other jquery function work properly.
- })(jQuery)