The problem:
when the input type on my submit button is changed to 'button' it does NOT save info to mysql but validation works. If i change it to input type on submit button to 'submit' it saves info to mysql but the validation does not work. Is there a resolution to this?
jquery validation - function on click:
$("input:button").click(function(){
var retVal = false;
$.each([1, 2], function(i, val){
retVal = (validate(val) || retVal);
});
return retVal;
On my form the submit button code is:
<input type="submit" value="Submit" />
The form action is:
<form name="list1"; action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
在jQuery代码中写$("input:submit")
而不是$("input:button")
我认为正确的方法是将按钮保留为<input type='submit' />
并使用$('form').submit(...)
根据验证返回true/false
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.