Sample text information for Html elements using the text method

  • 2020-03-30 03:48:17
  • OfStack

There are many methods to get text information, this example USES the text method of jquery, this method must have been used, simple and practical. After getting it and using alert to pop up the text, here's the implementation code

<!DOCTYPE html> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 p { margin:8px; font-size:20px; color:blue;  
   cursor:pointer; } 
 b { text-decoration:underline; } 
 button { cursor:pointer; } 
  <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script> 
<b>Show My Text</b> 
<div id="TEXT"></div> 
$("#TEXT").load("qqq.txt", function(response, status, xhr) { 
var text=$(this).text(); 
 alert( text); 

Related articles: