Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
110
rated 0 times [  114] [ 4]  / answers: 1 / hits: 26758  / 11 Years ago, thu, december 12, 2013, 12:00:00

I know how to load external text from a .txt file using



<div id=text> <div> 


and javascript



 $(#text).load(pathtofile/content.txt); // element's id should be in string form


but can this be done between two < p > tags instead of inserting into a div? if so how?



Thanks


More From » html

 Answers
2

To get the text from only a paragraph from the file, try this:

HTML:



<div id=tempDiv style=display: none;></div>
<p id=text></p>


JQuery:



 var tempDiv = $('#tempDiv');
tempDiv.load(pathToFile/content.txt);
var html = tempDiv.find('#theParagraphId').html();
$('#text').html(html);

[#73761] Wednesday, December 11, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
malaysias

Total Points: 619
Total Questions: 110
Total Answers: 107

Location: Czech Republic
Member since Thu, Aug 11, 2022
2 Years ago
;