hyperapp
hyperapp copied to clipboard
Add onChange
const { h, app } = hyperapp
/** @jsx h */
app({
model: 200,
actions: {
change: model => model + 1,
sub: model => model - 1,
},
view: (model, actions) => (
<div className="well clearfix">
<textarea className="form-control"
onChange={actions.change}></textarea>
<br/>
<span>{model}</span>
<button className="btn btn-primary pull-right"
disabled={model === 0}
onClick={actions.sub} >
Send</button>
</div>
)
})
I noticed that if I type in the textbox, the change function does not get activated.
Will it be added?
@AG-Systems I think you want onInput, not onChange.
Try this:
app({
view: state =>
<input
onChange={console.log}
onInput={console.log}
/>
})
@jbucaran @AG-Systems beware that onInput doesn't work on select in IE/Edge. It's an open bug since years...