Question: ```
$('#foo').live('keyup', function (e) {
  var input = $(this).val();
  // code to process input
});

```

This is used in a post form and I need to run the code inside the live() when the document is ready. Is there a way, other than to wait for a key press, to invoke it?

Answer: 
```
$(function() { 
   // add the event
  $('#foo').live('keyup', function (e) { 
  var input = $(this).val(); 
      // code to process input 
    }); 
  $('#foo').trigger('keyup');  //trigger the event
}); 

```
It sounds like you're saying that there's a part of the code that will run on `keyup` that you also want to run once when the page loads.

If that's the case, you can place that code inside another function, and call it both on page load and inside the `.live()` handler.

```
function someFunction() {
   // code to run
}

$('#foo').live('keyup', function (e) {
  var input = $(this).val();
    // run on keyup
  someFunction();
});

   // run on page load
someFunction();

```