This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
example.html
87 lines (72 loc) · 1.73 KB
/
example.html
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
<head>
<title>jQuery JSON Forms Fields</title>
<script type="text/javascript" src="src/jquery-2.1.1.js"></script>
<script type="text/javascript" src="src/jquery-json-form-binding.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var json = {
name: "Waleed",
country: "uk",
skill: ["html", "javascript"],
language: ["english", "german"],
sex: "female"
};
$("#myform").jsonToForm(json);
console.log($("#myform").serialize());
});
</script>
</head>
<body>
<form id="myform">
<div class="form-field">
<h5>
Text Input
</h5>
<input type="" name="name">
</div>
<div class="form-field">
<h5>
Single Select
</h5>
<select name="country">
<option value="usa">USA</option>
<option value="uk">UK</option>
<option value="germany">Germany</option>
</select>
</div>
<div class="form-field">
<h5>
Multiple Select
</h5>
<select multiple name="skill">
<option value="html">html</option>
<option value="css">css</option>
<option value="javascript">javascript</option>
<option value="node">node</option>
</select>
</div>
<div class="form-field">
<h5>
checkbox example
</h5>
<label>
<input type="checkbox" value="english" name="language" />English</label>
<label>
<input type="checkbox" value="french" name="language" />French</label>
<label>
<input type="checkbox" value="german" name="language" />German</label>
</div>
<div class="form-field">
<h5>
Radio example
</h5>
<label>
<input type="radio" value="male" name="sex" />Male</label>
<label>
<input type="radio" value="female" name="sex" />Female</label>
</div>
</form>
</body>
</html>