Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery create text input element and append to form "field focus" does not work in Firefox -problem

Tags:

jquery

I have the following code (see below) which makes the field focus on the inserted text input. But this does not work in Firefox. So I cannot type any text in Firefox.

$('<input/>').attr({ type: 'text', id: 'test', name: 'test' }).appendTo('#form');

Is there any fix for this?

Thanks in advance!

--

Correction to my question

I found out that the problem is caused by

$(selector).sortable().disableSelection()

The only resolution I have now is to not call

//disableSelection()

Any other suggestions are more then welcome.

like image 637
user558134 Avatar asked Apr 18 '11 09:04

user558134


1 Answers

try for focus

$('<input/>').attr({ type: 'text', id: 'test', name: 'test'}).appendTo('#form');

$('#test').focus(function(e) {
    alert('Focus');
});
like image 184
Abhay Yadav Avatar answered Nov 15 '22 05:11

Abhay Yadav