Samstag, November 21, 2009

get text only from selected element

The jQuery method text() returns the text not only of the selected element, but also of all sub elements.

To get only the text of the selected element clone it first, than remove all children. After this call text().

Keine Kommentare: