[jQuery] Re: How to text inside Tag of a Table?
On Nov 30, 6:43 am, "SharepointMag [yb]"
<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
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home