I can't figure out how to sort through collections. The $$ selector (". First input") returns a set:
[<input type=β"checkbox" id=β"id-9" name=β"ids[]β" value=β"9">β, <input type=β"checkbox" id=β"id-23" name=β"ids[]β" value=β"23">β, <input type=β"checkbox" id=β"id-24" name=β"ids[]β" value=β"24">β, <input type=β"checkbox" id=β"id-27" name=β"ids[]β" value=β"27">β, <input type=β"checkbox" id=β"id-1" name=β"ids[]β" value=β"1">β]
I check the marked elements, if checked, then put its id in the array:
var checkedElemets = []; var elements = $$(".first input"); for(var i in elements){ if(elements[i].getValue('checked') != null){ checkedElemets.push(elements[i].getValue('checked')); } }
The browser swears that there is no getValue method in the elements [i] object. Please help me understand my mistakes.
Moreover, the construction elements [i] .getValue ('checked') where i is the ordinal number of the element, in the console works fine:> elements [0]. GetValue ('checked') returns> "9"
elements[i].Π·Π½Π°ΡΠ΅Π½ΠΈΠ΅
returns an attribute with the nameΠ·Π½Π°ΡΠ΅Π½ΠΈΠ΅
. For example:elements[i].value
returns thevalue
attribute. - Rules