<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="../static/React/react.js"></script>
<script src="../static/React/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
</head>
<body>
<div id="example"></div>
<h1 onclick="ss(this)">click</h1>
<script type="text/babel">
var Hst = React.createClass({
handleClick:function () {
this.refs.myTextInput.focus();
},
render:function () {
return (<div>
<input type="text" ref="myTextInput" value="" id="sss"/>
<input type="button" value="please the input" onclick={this.handleClick}/>
</div>)
}
});
ReactDOM.render(
<Hst/>,
document.getElementById('example')
)
</script>
<script>
var ss = function (o) {
o.innerHTML=document.getElementById("#sss").value;
}
</script>
</body>
</html>
我想把ID="SSS"的input值输出来,但是这样不行
没有#