Make sure you have the right selector, and then wait until the page is ready and that the element exists until you run the function.
$(function(){
$('#searchBar').val('hi')
});
As Derek points out, the ID is wrong as well.
Change to $('#main_search')