Dave
Dave

Reputation: 187

nyroModal Set Focus

Using nyroModal I have setup a modal window with some text boxes. This window pops up on page load. I need focus to be set to the first text box. I have tried this, but it doesn't work:

$(document).ready(function () {

$.nmManual('pageToLoad.html'});

$.fn.nyroModal.settings.endShowContent = function(elt, settings) {
    $('input:text:first', elt.content).focus();
};
...some more code here...
});

There isn't much documentation for the endShowContent, so hopefully someone here can lend me a hand.

Upvotes: 0

Views: 862

Answers (2)

Cédric Nirousset
Cédric Nirousset

Reputation: 347

The right code should be:

$.nmManual('pageToLoad.html', {
  callbacks: {
    afterShowCont: function(nm) {
      nm.elts.cont.find('input:text:first').focus();
    }
  }
});

Upvotes: 0

zb'
zb'

Reputation: 8059

As i found from docs of nyroModal it should called by:

$.nmManual('pageToLoad.html',{callbacks: {afterShowCont: function() {}}}

Upvotes: 1

Related Questions