Figured it out. Here is the answer.
$( ".class" ).attr('onclick', 'whatever I want it to be');
So you can do it this way.
<h:commandLink class='btn' onClick="hi" value="Button"/>
var text = $('.btn').attr('onclick');
$('.btn').attr('onclick', "function("+text+")");
Take it a bit further and do it for every button on the screen.
$('.btn').each(function () {
var text = $(this).attr('onclick');
$(this).attr('onclick', "function("+text+")");
});