Change the text of the <p> element to "Hello World!". - Javascript jQuery

Javascript examples for jQuery:Text

Description

Change the text of the <p> element to "Hello World!".

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("p").text("Hello World!");
});//from  www  .  ja  v  a  2 s .c  om
</script>
</head>
<body>

<p>This is some text.</p>

</body>
</html>

Related Tutorials