Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to change text of paragraph on click in java scriopt

<!DOCTYPE html>
<html>
<body>

<p>When you click a button it will change the text of sample paragraph.</p>

<p id="demo">I am sample paragraph.</p>

<button onclick="change_text()">Click me</button>

<script>
function change_text(){
    document.getElementById("demo").innerHTML = "You clicked the button, I am new paragraph.";
}
</script>

</body>
</html>
Source by errorsea.com #
 
PREVIOUS NEXT
Tagged: #change #text #paragraph #click #java #scriopt
ADD COMMENT
Topic
Name
6+1 =