forked from olahol/react-tagsinput
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
74 lines (69 loc) · 1.77 KB
/
index.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
<!doctype html>
<html>
<head>
<title>react-tagsinput example (without JSX)</title>
<link rel="stylesheet" href="../react-tagsinput.css">
<style>
* {
margin: 0;
padding: 0;
border: 0;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
background: #eeefef;
}
#tags {
width: 80%;
margin: 100px auto;
}
button {
background: #e74c3c;
color: #fff;
border: 1px solid #c0392b;
width: 70px;
height: 30px;
border-radius: 2px;
font-size: 12px;
font-weight: bold;
float: right;
margin-top: 10px;
line-height: 30px;
cursor: pointer;
outline: none;
}
</style>
</head>
<body>
<div id="tags"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-with-addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-dom.js"></script>
<script src="../react-tagsinput.js"></script>
<script>
var TagsComponent = React.createClass({
displayName: "TagsComponent",
getInitialState: function() {
return {
tags: ["tag1", "tag2"]
};
},
saveTags: function () {
console.log("tags: ", this.state.tags.join(", "));
},
handleChange: function(value) {
this.setState({tags: value});
},
render: function () {
return (
React.createElement("div", null,
React.createElement(ReactTagsInput, {value: this.state.tags, onChange: this.handleChange}),
React.createElement("button", {onClick: this.saveTags}, "Save")
)
);
}
});
ReactDOM.render(React.createElement(TagsComponent, null), document.getElementById("tags"));
</script>
</body>
</html>