<sharepoint...@googlemail.com> wrote:
> var $elements = $('table');
> $elements.each(function(){
> // here i want to get the text inside the caption tag inside THIS element ...
> }
var captionText = $("caption", this).text();
The second parameter to the "$" function is a context to search in.
In this case, "this" is the current table element, exactly what you
want for a context. The following would also work, and I don't know
if there is any real internal difference between them:
var captionText = $(this).find("caption").text()
Cheers,
-- Scott
No comments:
Post a Comment