.focus() doesn't work on an input while orher attributes works

Posted by Sirber on Stack Overflow See other posts from Stack Overflow or by Sirber
Published on 2010-05-03T20:13:56Z Indexed on 2010/05/03 20:18 UTC
Read the original article Hit count: 186

I have a classic table / thead / tbody structure, which I add a line at the end of the tbody. The line contains only an input element. The code works in Firefox 3.6 but not in Chrome v5 or IE8. I'm using jQuery 1.4.1.

Does not work: $("#" + AJAX_ID).parent().find('tr:last > td:nth-child(2) > input').focus();

Does work: $("#" + AJAX_ID).parent().find('tr:last > td:nth-child(2) > input').css('background-color', 'red');

even setting an ID on the input, and using document.getElementBuId('id').focus() doesn't work.

Thank you!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript