Newbie jQuery question
Newbie jQuery question
I am trying to understand how chaining works with jQuery. Why is it that the variable "allOptionsPool1" in line 5 below correctly contains the value of the array contained in "allOptions", but "allOptionsPool2" in line 8 is undefined after its execution?
Also, after execution the 'Pools' element contains an object named "allOptions", but not "allOptions2".
- var allOptions = [{ key: '0', value: '0', text: 'Text 0' }, { key: '1', value: '1', text: 'Text 1' }, { key: '2', value: '2', text: 'Text 2' }];
- var pools = $('#Pools');
- pools.allOptions = allOptions;
- var allOptionsPool1= pools.allOptions;
- $('#Pools').allOptions2 = allOptions;
- var allOptionsPool2 = $('#Pools').allOptions;