Input focus for firefox and safari doesn't seem to work
The following should refocus an input element with a name of 'test' if it contains an empty string. This works for IE (8.0.7600) but not in Firefox (3.6.15) or Safari (5.0.4)
- $('input[name=test]').blur(function() {
- var $this = $(this);
- if (!$this.val()) {
- $this.focus();
- return false;
- }
- return true;
- });