Skip to content
Kyle Robinson Young edited this page Mar 7, 2016 · 6 revisions

Input and Submit Button

An element that consists of an input field and button when pressed will return the value submitted.

var bel = require('bel')
module.exports = function (onsubmit) {
  var input = bel`<input type="text" value="" />`
  return bel`<form onsubmit=${function (e) {
    e.preventDefault()
    onsubmit(input.value)
  }}>
    <label>Your Name:</label>
    ${input}
    <button type="submit">submit</button>
  </form>`
}
Clone this wiki locally