Enhance Existing Code

Example from hyperscript.org landing page
Hyperscript works side by side with existing JavaScript. You choose what and when to enhance. Use locality of behavior, external behaviors, or write web workers with ease.

Demo 1: Inline JavaScript

Click a button to run JavaScript...

Demo 2: JavaScript with Parameters

Enter text and click to search...

Demo 3: Access Browser APIs

Click to get browser information...

The Exact Code

<div _="init js alert('Hello from JavaScript!') end"></div> <div _="init js(haystack) return /needle/gi.exec(haystack) end"> <div _="install Draggable(dragHandle: .titlebar)">

Extended Version

<!-- Simple inline JS --> <button _="on click js alert('Hello!') end"> Alert </button> <!-- JS with return value --> <button _="on click js return new Date().toISOString() end put it into #result"> Get ISO Date </button> <!-- JS with parameters --> <button _="on click set text to #input.value js(text) return text.toUpperCase() end put it into #result"> Uppercase </button>

Features Demonstrated