Tuesday, July 24, 2012

javascript – Get paragraph text inside an element



I want to have the text value from a <p> inside a <li> element.


html:



<ul>
<li onclick=\"myfunction()\">
<span></span>
<p>This Text</p>
</li>
</ul>


javascript:



function myfunction() {
var TextInsideLi = [the result of this has to be the text inside the paragraph\"];
}


How to do this?






Rating: 4 out of 5 based on 6 ratings



The post javascript – Get paragraph text inside an element appeared first on Javascript ASK.






via Javascript ASK http://javascriptask.phpfogapp.com/javascript-get-paragraph-text-inside-an-element.html

No comments:

Post a Comment