(Taken from my
Consider the difference between these two lines:
$('tr'); // returns array of tr
$('tr').toEnumerable().TojQuery(); // returns array of tr
Converting from jQuery to Enumerable and back to jQuery does not give you what you started with. The end result is an array of arrays of elements, with each sub-array having a length of 1. I do need to make use of Enumerable, so this is just a convenient
example of my problem.
This means that to get the id of an element, you'd need to do the following:
$('tr').id; // returns "myID"
$('tr').toEnumerable().TojQuery().id; // returns "myID"
I'm surprised of this, because even though I've allegedly gone back
TojQuery(), the object returned by
TojQuery() does not work with typical jQuery calls:
$('tr').find('td').length; // returns 170 (in my case)
$('tr').toEnumerable().TojQuery().find('td').length; // returns 0 (BAD)
So, my questions:
- Why is this?
- Am I doing it wrong?
- If not, any good workarounds? (convert
array of 1-element arrays to
array of elements?)