Imperative
HTML
<div>
<input id="name" type="text" />
<h2 id="greeting">Hello</h2>
</div>
JavaScript
//look up the input element
var name = $('#name');
//look up the output element
var greeting = $('#greeting');
//listen for keyboard events
name.keyup(function() {
//update the output element with the new input
greeting.text('Hello ' + name.val());
});