Select a bunch of lines, and then do this:
:let i=1 | '<,'>g/^/ s//\=i/ | let i+=1
All this does is set an interval to execute every 100 milliseconds. It checks if the item exists (since the jQuery length function will return zero if it does not). If it does exist, it adds the jQuery event handler and removes the interval.var checkExist = setInterval(function() {if(jQuery("#someid").length) {jQuery("#someid").click( function() {// click handler code});clearInterval(checkExist);}}, 100);
$._data($('#yourid')[0], "events");This also works as of the date of this writing on jQuery 1.9, but it might be disabled at some point.