loading external text from .txt to a html file

后端 未结 1 1453
后悔当初
后悔当初 2021-01-06 09:14

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

and javascript

 $(\"#text\").l         


        
1条回答
  •  粉色の甜心
    2021-01-06 10:15

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

    
    

    JQuery:

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

    0 讨论(0)
提交回复
热议问题