I’m new in Jquery, I can’t access the elements within the Jquery object.
var iconNumber=$('#tblFeedControlBar').find('td').length; // 8
var iconNumber=$('#tblFeedControlBar').find('td')[0].width(); // error
$('#tblFeedControlBar').find('td').get(0).after(iconArrow); // error
When you index into a jQuery object, you get the raw DOM element at that position, not a jQuery wrapper for it. And that’s true of the
getfunction as well. (In fact, unless you use a negative index,getreally just turns around and does[]for you; with negative indexes it does a bit more work.)If you want the width of the first element (I assume
withwas meant to bewidth), by default that’s what you get if you call it on a set:Even though there may be more than one element in that set, in general jQuery’s “get” operations act on the first element in the set. (The API is assymetrical; “set” operations act on the whole set.)
If you wanted the width of the second element:
Or making the steps clearer: