willa
willa

Reputation: 669

Focus working on chrome but not IE

I have a focus for the first elements on a form as long as they are Text Boxes, Password Fields and drop downs. I am having a Issue with IE at at the moment the Jquery is working find and as expected in chrome but not IE.

$('#pagebody').find('input[type=text],input[type=password],select,textarea').filter(':visible:first').focus(); 

I was just wondering why this is working in Chrome but not the IE. Thanks for any help which you can provide

Upvotes: 0

Views: 177

Answers (1)

Bhushan Kawadkar
Bhushan Kawadkar

Reputation: 28523

Try this : call jQuery code inside document.ready because IE calls .focus() method on fully rendered elements. See this

$(document).ready(function(){
  $('#pagebody').find('input[type=text],input[type=password],select,textarea').filter(':visible:first').focus();
});

Upvotes: 1

Related Questions