nearest ancestor <p> tag
nearest ancestor <p> tag
i have problems with selecting the text from nearest p tag, i think this code suppose to return 'some text:' but instead i returns 'some text: DoneImportant'
-
<p id="2009-05-02 11:35:03"> some text: <span id="buttons">
<button class="imgreplacement done">Done</button>
<button class="imgreplacement important">Important</button> </span></p>
-
$('button.done').click(function(){
alert( $(this).parents('p:first').text() );
});
msg in alert box:
some text: DoneImportant
what i'm doing wrong? have can i select text from neartest p tag?