jquery submit enable / disable
<script>$("#submit1").click(function(){
/*validation here*/
$("#inputForm").submit();
function();
parent.function();
});</script>
jquery submit enable / disable
function enableSubmit(id) { $('input[id$="submit' + id + '"]').attr('disabled', false); }
jQuery Submit Form Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| < html > < head > < script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" ></ script > </ head > < body align = "center" > < div align = "center" > < h1 >Jquery Form Submit Demo</ h1 > < form name = "myForm" id = "testForm" method = "POST" action = "send.php" > UserName: < input type = "text" name = "user" value = "test" /> < br /> Password: < input type = "password" name = "password" value = "test" /> < br /> </ form > < br /> < input type = "button" id = "submit1" value = "Submit by Form ID" /> < input type = "button" id = "submit2" value = "Submit by Form Name" /> < input type = "button" id = "submit3" value = "Submit by Form Index" /> < input type = "button" id = "submit4" value = "Submit with Event Handler" /> </ div > </ body > < script > $(document).ready(function() { $("#submit1").click(function() { $("#testForm").submit(); }); $("#submit2").click(function() { $("form[name='myForm']").submit(); }); $("#submit3").click(function() { $("form:first").submit(); }); $("#submit4").click(function() { $("#testForm").submit(function() { alert('Form is submitting'); return true; }); $("#testForm").submit(); //invoke form submission }); }); </ script > </ html > |
沒有留言:
張貼留言