I need to get content from a UL list and then be able to use that to email. But I'm stuck on getting the ul list in jquery. I've searched and found the following:
$(document).ready(function(){
$("#send").click(function() { //When trigger is clicked...
var optionTexts = [];
$("#thelist").each(function() { optionTexts.push($(this).text()) });
var text = '"' + optionTexts.join('"<br/> "') + '"';
$("#result").append(text);
});
});
but this returns all contents inside the page :S Here's my ul list:
<ul id="thelist">
<li style="height: 65px; display: list-item; ">
<ul>
<li class="botHeader">
"Evelin dice"
<span>14:37:52</span>
</li>
<li class="botMsg">
"Hola, bienvenido"
</li>
<ul>
</li>
<li style="height: 26px; display: list-item; ">
<ul>
<li class="userHeader">
"Usted dice"
<span>14:37:59</span>
</li>
<li class="userMsg">
"Hola como estas"
</li>
<ul>
</li>
<li style="height: 39px; display: list-item; ">
<ul>
<li class="botHeader">
"Evelin dice"
<span>14:37:59</span>
</li>
<li class="botMsg">
"Gracias por preguntar, todo bien"
</li>
<ul>
</li>
</ul>
<a href="#" id="send">enviar</a>
<div id="result">
</div>