[jQuery] How to select sub element text on clicking the parent element.
Hi,
I am newbie to the jquery. Please let me know, how i can do this.
<div id="questions-page">
<div id="question">
question1
<ul>
<li>answer1</li>
</ul>
</div>
<div id="question">
question2
<ul>
<li>answer2</li>
</ul>
</div>
</div>
The question is.. Onclicking "question1", I should popup "answer1".
<code>
<script>
window.onload = function() {
$("#questions-page #questions p").click(function(){
text=""; // I want here to get the value of answer.
alert('answer is'+text);
});
};
</script>
</code>