質問

I am not able to put focus on the magi8csuggests input element through java script, I even tried triggering FOCUS event on the Input element, but no success. I created my magicsuggest by:

_ccSuggest=$("#ccSuggest").magicSuggest({
    resultAsString: true,
    dataUrlParams: 
    minChars: 1,
    displayField: 'fullname',
    selectionStacked: false,
    data: strUrl,
    typeDelay:400
});

Now I want to put focus in the Input element as soon as I open my div which holds this magic suggest. Any Help?

Thanks

役に立ちましたか?

解決

In following the official doc : http://nicolasbize.github.io/magicsuggest/#tab-4

The author initialize with :

$('#ms-right').magicSuggest({
    width: 250,
    selectionPosition: 'right',
    data: 'red,orange,blue,purple,dark blue,yellow,green,magenta,cyan,black,white'
});

So to focus on the input :

$('#ms-right input').focus();

Tested with chrome v32.0.1700.107, it works...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top