I have a problem with hiding keyboard in the iPhone simulator. My HTML code:
Instead of switching focus to another element you can simply blur your input like this:
$('#searchBar').blur();
It will hide the virtual keyboard.