- <!DOCTYPE html>
- <html>
- <head>
- <metacharset="UTF-8">
- <title></title>
- <scripttype="text/javascript"src="js/jquery-2.1.4.min.js"></script>
- </head>
- <body>
- <p><b>Hello</b> fine</p>
- <p>Thank you!</p>
- </body>
- <script>
- alert($("p").html());//Get the first html element under p
- alert($("p").text());//Get all the text values of p
- alert($("p").val());// Must have value attribute to get it
- </script>
- </html>
jquery html() text() val() difference
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325784740&siteId=291194637
Recommended
Ranking