Editing an element with .html() and applying a handler with .click() in one statement
<p>In jQuery I am often writing pairs of statements to alter a button and its event like:</p>

<pre><code>$("#button-container").html("&lt;img id='button' src='button.png'&gt;");
$("#button").click(buttonFunction);
</code></pre>

<p>Am I missing some obvious/easy way to do this in one line, like in:</p>

<pre><code>$("#button-container").html("&lt;img id='button' src='button.png'&gt;").click(buttonFunction);
</code></pre>

<p>?</p>
