How to focus the autofocus element in jQuery ui dialog? -
As I want to set an element when a jQuery dialogue is open. I wrote this code like this:
$ (". Selector"). Dialog ({title: "dialog", button: [[text: "yes", click: function () {}}, {text: "no", autofocus: true}]});
This is for this matter.
It looks like I want IE9 + / Firefox / etc, but not in IE8. So I found the _focusTabbable function in jquery-ui.
var hasFocus = this.element.find ("[autofocus]"); If (! HasFocus.length) {hasFocus = this.element.find (": tabbable"); } If (! Hypocus lamps) {hasFocus = this.uiDialogButtonPane.find (": tabbable"); }
This will only find autofocus elements in UI-content, not in the Button panel. How can I come in: tab in iiDialogButtonPaneBible, but not applicable [Autofocus]?
More interesting in IE11 / Firefox also, I noticed that the function centered the "yes" button at the end, but a popup with a focus on the "No" button popped up. No reason can be found.
Comments
Post a Comment