It is crucial that the index of an object is always represented as a string:
var obj = {
a: 2;
}
obj.a = 3; //a now equals 3
obj['a'] = 4;//now a equals 4
You mentioned that options.elements[x].selector
is input[name="username"]
, so it seems like in this line:
this.inputs[options.el.find('form').attr('class')][options.elements[x].selector] = false;
What you actually intend to achieve is:
this.inputs[options.el.find('form').attr('class')]['username'] = false;
To accomplish this, you can modify the code in the following way:
var sel = options.elements[x].selector;
console.log( 'sel is ' + sel );
this.inputs[options.el.find('form').attr('class')][sel] = false;
Ensure that sel is indeed a string. You might want to experiment with
var sel = options.elements[x].selector.value;
The .value
part extracts the text from within an input element.