I am trying to get the text of the span
tag with javascript, but the sending of the data remains in null. This is how I have the code:
html:
<div class="col-lg-10 ">
<span id="trunc">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</span>
</div>
javascript:
var lengthText = 90;
//Aqui en la variable text guardas el texto antes de ocultarlo
var text = $("#trunc").text();
var shortText = $.trim(text).substring(0, lengthText).split(" ").slice(0, -1).join(" ") + "...";
console.log(text);
console.log(shortText);
This is the image of how you send the information in the console:
I will be grateful if you can help me with this situation.