0

I am familiar to jQuery selector like $('form') but I am not able to understand what the selector $('form', currentPanel) in the below code mean. Please help.

_onWizardNextClick : function() {
 var currentPanel = this.getActivePanel();
 var form = $('form', currentPanel);
 if (form.length == 1 && form.data('validator') && !form.valid()) {
  return;
 }
}
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
code chimp
  • 359
  • 2
  • 8
  • 21
  • thats the [context](https://stackoverflow.com/questions/16422478/what-is-context-in-jquery-selector)... – Sudhir Bastakoti May 30 '17 at 07:38
  • [it's context](http://api.jquery.com/jQuery/#jQuery1) and this was easy to find on google despite i've never seen it either – Andrew May 30 '17 at 07:38
  • 1
    `$(currentPanel).find("form") == $("form", currentPanel)` – freedomn-m May 30 '17 at 07:41
  • It says, select `form` AND `currentPanel` elements. `currentPanel` is just and DOM element that `this.getActivePanel()` returns – Ikhlak S. May 30 '17 at 07:45
  • @user3284463 no, it says, select `form` elements that are below `currentPanel` in the DOM tree (like 'allChildren' or just `find`). It looks like you're thinking of the comma selector, like this: $(".panel, form") which would select all `.panel` and all `form` elements. That's not the case here. – freedomn-m May 30 '17 at 08:03
  • @freedomn-m, Thanks. – code chimp May 30 '17 at 08:24
  • @freedomn-m and codechimp Thanks, I just learnt something new :) – Ikhlak S. May 30 '17 at 08:30

0 Answers0